:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --line: #e3e5e8;
  --brand: #1f75b2;        /* синий кольца логотипа */
  --brand-dark: #165a8b;
  --ink: #111418;          /* чёрный шрифта логотипа */
  --accent: var(--brand);
  --accent-soft: #e6f1f9;
  --ok: #1d7a46;
  --ok-soft: #e6f4ec;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --nk: #6b3fa0;
  --nk-soft: #f1eafa;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

header.top { display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 76px;
             background: #fff; color: var(--ink); border-bottom: 3px solid var(--brand);
             position: sticky; top: 0; z-index: 5; box-shadow: 0 1px 6px rgba(17,20,24,.06); }
header.top a { color: var(--ink); }
header.top .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
header.top .brand img { height: 60px; display: block; }
header.top .brand span { font-size: 12px; color: var(--muted); line-height: 1.2; border-left: 1px solid var(--line); padding-left: 12px; }
header.top nav { display: flex; gap: 2px; flex: 1; }
header.top nav a { padding: 8px 12px; border-radius: 6px; font-weight: 500; }
header.top nav a:hover { background: var(--accent-soft); text-decoration: none; }
header.top nav a.on { color: var(--brand); background: var(--accent-soft); text-decoration: none; }
header.top .me { display: flex; gap: 14px; align-items: center; font-size: 13px; }
header.top .me a { color: var(--muted); }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }

footer.site { max-width: 1280px; margin: 8px auto 0; padding: 14px 24px 24px; color: var(--muted); font-size: 12px;
              border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
footer.site a { color: var(--muted); }

/* страница входа — по мотивам титульного листа */
.titlesheet { max-width: 760px; margin: 36px auto; background: #fff; border: 1px solid var(--line);
              border-top: 4px solid var(--brand); border-radius: 4px; padding: 28px 40px 22px;
              box-shadow: 0 6px 24px rgba(17,20,24,.06); }
.titlesheet .req { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.titlesheet .req img { height: 74px; }
.titlesheet .req .lines { font-size: 12px; color: var(--muted); line-height: 1.55; text-align: right; }
.titlesheet .doc { text-align: center; margin: 34px 0 26px; }
.titlesheet .doc .kind { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--brand); font-weight: 600; }
.titlesheet .doc h1 { font-size: 26px; margin: 8px 0 6px; color: var(--ink); }
.titlesheet form { max-width: 340px; margin: 0 auto; }
.titlesheet .year { text-align: center; color: var(--muted); margin-top: 26px; font-size: 13px; }
@media (max-width: 760px) {
  .titlesheet { margin: 12px; padding: 20px 18px; }
  .titlesheet .req .lines { text-align: left; }
}

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid2 > div > .card:last-child { margin-bottom: 0; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.empty { color: var(--muted); padding: 6px 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-dev, .st-new, .st-work { background: var(--accent-soft); color: var(--accent); }
.st-nk { background: var(--nk-soft); color: var(--nk); }
.st-nk_remarks, .st-review { background: var(--warn-soft); color: var(--warn); }
.st-nk_ok { background: #e6f2f4; color: #13707f; }
.st-accepted, .st-done { background: var(--ok-soft); color: var(--ok); }
.overdue { color: var(--bad); font-weight: 600; }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.kind { background: #eef0f3; color: #4a5160; }
.prio-high { color: var(--bad); font-weight: 600; }

form.inline { display: inline; }
.form { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=date], input[type=url], input[type=email], select, textarea {
  font: inherit; color: var(--text); padding: 7px 9px; border: 1px solid #cfd3d9; border-radius: 6px; background: #fff; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.check { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }

.btn { display: inline-block; font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent);
       background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.sec { background: #fff; color: var(--accent); }
.btn.small { padding: 3px 9px; font-size: 12px; font-weight: 500; }
.btn.danger { background: #fff; color: var(--bad); border-color: #e7b4ae; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

details.add > summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; margin-bottom: 8px; }
details.add > summary::-webkit-details-marker { display: none; }
details.add[open] > summary { margin-bottom: 12px; }

dl.props { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; }

.counters { display: flex; gap: 6px; flex-wrap: wrap; }
.remark { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.remark:last-child { border-bottom: 0; }
.remark .txt { flex: 1; }
.remark.resolved .rt { color: var(--muted); text-decoration: line-through; }
.feed .item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed .item:last-child { border-bottom: 0; }
.feed .meta { font-size: 12px; color: var(--muted); }
.auth { max-width: 380px; margin: 60px auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile .n { font-size: 24px; font-weight: 700; }
.tile.bad .n { color: var(--bad); }

/* выбор-плашки (тип договора) */
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; border-radius: 8px; }
.choice .opt { display: flex; gap: 10px; align-items: center; color: var(--ink); font-size: 14px; font-weight: 500;
               border: 1px solid #cfd3d9; border-radius: 8px; padding: 12px 14px; cursor: pointer; background: #fff; }
.choice .opt:has(input:checked) { border-color: var(--brand); background: var(--accent-soft); }
.choice .opt input { width: auto; margin: 0; accent-color: var(--brand); }

.choice.small2 { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
.choice.quad { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.choice.quad .opt { padding: 10px 12px; }
@media (max-width: 760px) { .choice.quad { grid-template-columns: repeat(2, 1fr); } }
.choice.small2 .opt { padding: 8px 12px; }
.lbl { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
table.compact td { padding: 4px 8px 4px 0; font-size: 13px; }
/* срок в днях под датой */
.datefield { display: grid; gap: 4px; align-content: start; }
.term { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.term input[type=number] { width: 78px; padding: 5px 7px; }
.term select { width: auto; padding: 5px 7px; }
.warnhint { color: var(--warn); }
tr.conflict td { background: var(--bad-soft); }

/* график выполнения работ — диаграмма Ганта */
.gantt { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.g-row { display: grid; grid-template-columns: 290px minmax(640px, 1fr); align-items: stretch;
         border-bottom: 1px solid var(--line); min-height: 48px; min-width: 930px; }
.g-row:last-child { border-bottom: 0; }
.g-head { background: #f7f8fa; font-size: 12px; color: var(--muted); min-height: 30px; position: sticky; top: 0; z-index: 3; }
.g-head .g-name { display: flex; align-items: center; }
.g-name { padding: 7px 10px; font-size: 13px; line-height: 1.25; position: sticky; left: 0; background: #fff; z-index: 3;
          border-right: 1px solid var(--line); }
.g-head .g-name { background: #f7f8fa; }
.g-title { font-weight: 500; }
.g-badges .badge { margin-left: 4px; font-size: 11px; padding: 1px 6px; }
.g-text { margin-top: 3px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.g-inputs { display: flex; gap: 4px; align-items: center; margin-top: 4px; }
.g-inputs input[type=date] { padding: 2px 4px; font-size: 12px; width: 118px; }
.g-reset { padding: 1px 6px !important; }
@media (max-width: 760px) {
  .g-row { grid-template-columns: 170px minmax(560px, 1fr); min-width: 730px; }
  .g-name { font-size: 12px; padding: 6px 8px; }
  .g-inputs { flex-wrap: wrap; }
  .g-inputs input[type=date] { width: 112px; }
}
.g-card > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.g-card > summary::-webkit-details-marker { display: none; }
.g-card > summary h2 { margin: 0; }
.g-card > summary h2::before { content: '▸'; display: inline-block; width: 18px; color: var(--muted); transition: transform .15s; }
.g-card[open] > summary h2::before { transform: rotate(90deg); }
.g-card > summary .g-toggle::after { content: 'развернуть'; }
.g-card[open] > summary .g-toggle::after { content: 'свернуть'; }
.g-card > summary .g-toggle { margin-left: auto; text-decoration: underline dotted; }
.g-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding: 10px 12px;
         border: 1px dashed var(--line); border-radius: 8px; }
.g-add input[type=text] { flex: 1 1 280px; min-width: 200px; }
.g-add input[type=date] { width: 140px; }
.g-mini { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 13px; }
.g-mini:hover { color: var(--brand); }
/* справка по объекту */
.info h3 { margin: 22px 0 8px; font-size: 15px; }
.info-title { font-style: italic; }
.info-table th { white-space: normal; vertical-align: bottom; }
.info-table td { vertical-align: top; }
.info-list { margin: 4px 0; padding-left: 20px; }
.info-list li { margin: 2px 0; }
.info-text { white-space: pre-line; line-height: 1.5; }
.info-edit td, .info-edit th { padding: 4px; vertical-align: top; }
.info-edit input[type=text], .info-edit textarea { width: 100%; min-width: 110px; resize: vertical; }
.report { padding: 12px 0; border-top: 1px solid var(--line); }
.report:first-of-type { border-top: 0; }
.objinfo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* статус сметной документации */
main.wide { max-width: none; }
.sm-head .props { margin: 0; }
.sm-head .props input { width: 100%; max-width: 520px; }
.sm-progress { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.sm-step { display: inline-flex; align-items: center; gap: 6px; }
.sm-bar { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: #eceef2; overflow: hidden; }
.sm-bar span { display: block; height: 100%; background: var(--ok); }
.sm-wrap { max-height: calc(100vh - 230px); overflow: auto; }
.sm-table { font-size: 12px; border-collapse: separate; border-spacing: 0; }
.sm-table th { position: sticky; top: 0; z-index: 1; background: #f7f8fa; white-space: normal; vertical-align: bottom;
               font-size: 11px; line-height: 1.25; min-width: 70px; }
.sm-table td { vertical-align: top; border-bottom: 1px solid var(--line); }
.sm-table .sm-name { min-width: 230px; }
.sm-table th.sm-t, .sm-table td.sm-t { min-width: 150px; }
.sm-table td.sm-m { text-align: center; font-weight: 500; white-space: nowrap; }
.m-yes { background: #dff3e4 !important; color: #1e6b33; }
.m-no { background: #ffe7c7 !important; color: #8a4b00; }
.m-na { background: #eef0f3 !important; color: var(--muted); }
.sm-table.editing td { padding: 3px; }
.sm-table.editing input, .sm-table.editing textarea, .sm-table.editing select { width: 100%; font-size: 12px; padding: 3px 5px; resize: vertical; }
.sm-table.editing textarea { min-height: 28px; line-height: 1.3; overflow: hidden; }
.sm-table.editing td:nth-child(2) input { min-width: 90px; }
.sm-table.editing td:nth-child(3) input { min-width: 110px; }
.sm-table.editing select { min-width: 80px; }
.sm-ops { white-space: nowrap; }
.smcard .sm-progress { border-top: 0; padding-top: 0; margin-top: 6px; }
@media print { .sm-wrap { max-height: none; overflow: visible; } .sm-table th { position: static; } }

/* таблица в стиле Google Таблиц */
.print-only { display: none; }
@media print { .print-only { display: block; } .print-only .sm-table { font-size: 9px; } @page { size: landscape; } }
.sh-card { padding: 0; overflow: hidden; }
.sh-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid #dadce0; background: #f8f9fa; font-size: 12px; min-height: 32px; }
.sh-ref { color: #5f6368; min-width: 220px; padding-right: 10px; border-right: 1px solid #dadce0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-fx { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #202124; }
.sh-fx::before { content: 'fx'; font-style: italic; color: #9aa0a6; margin-right: 8px; }
.sh-status { color: #5f6368; white-space: nowrap; }
.sh-status.busy { color: #1a73e8; }
.sh-status.ok { color: #188038; }
.sh-status.err { color: #d93025; font-weight: 500; }
.sheet { overflow: auto; max-height: calc(100vh - 300px); min-height: 220px; outline: none; background: #fff; position: relative; }
.sh-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; font-family: Arial, sans-serif; }
.sh-table th, .sh-table td { border-right: 1px solid #e2e3e3; border-bottom: 1px solid #e2e3e3; padding: 3px 6px; height: 24px;
  overflow: hidden; white-space: pre-wrap; word-break: break-word; vertical-align: top; text-align: left; background: #fff; }
.sh-table thead th { position: sticky; top: 0; z-index: 3; background: #f8f9fa; color: #3c4043; font-weight: 500; font-size: 11px;
  line-height: 1.25; vertical-align: bottom; text-transform: none; letter-spacing: 0; }
.sh-table thead th.hl, .sh-table th.sh-rowhead.hl { background: #d3e3fd; color: #041e49; }
.sh-table .sh-frz { position: sticky; z-index: 2; }
.sh-table thead .sh-frz { z-index: 4; }
.sh-table .sh-frz-last { box-shadow: 2px 0 0 #c6c9cc; }
.sh-table th.sh-rowhead, .sh-corner { background: #f8f9fa; color: #5f6368; text-align: center !important; font-size: 11px; font-weight: 400;
  cursor: pointer; user-select: none; }
.sh-cell { cursor: cell; user-select: none; position: relative; }
.sh-cell.inrange { background: #e8f0fe; }
.sh-cell.sel { box-shadow: inset 0 0 0 2px #1a73e8; }
.sh-cell.editing { overflow: visible; z-index: 5; }
.sh-editor { position: absolute; left: -1px; top: -1px; width: calc(100% + 2px); min-height: calc(100% + 2px); z-index: 6;
  border: 2px solid #1a73e8; padding: 2px 5px; font: inherit; resize: none; outline: none; background: #fff;
  box-shadow: 0 2px 6px rgba(60, 64, 67, .3); overflow: hidden; }
.sh-mark { text-align: center !important; }
.sh-chip { display: inline-block; padding: 1px 10px; border-radius: 12px; font-size: 12px; line-height: 18px; cursor: pointer; }
.sh-chip.m-yes { background: #d4edbc; color: #11734b; }
.sh-chip.m-no { background: #ffe5a0; color: #7a4a00; }
.sh-chip.m-na { background: #e8eaed; color: #5f6368; }
.sh-drop { position: absolute; right: 4px; top: 4px; font-size: 10px; color: #9aa0a6; cursor: pointer; display: none; }
.sh-cell.sel .sh-drop, .sh-cell:hover .sh-drop { display: inline; }
.sh-empty { color: #5f6368; padding: 18px !important; white-space: normal !important; }
.sh-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid #dadce0; background: #f8f9fa; font-size: 13px; }
.sh-foot input[type=number] { width: 64px; padding: 3px 6px; }
.sh-help { flex-basis: 100%; }
.sh-menu { position: absolute; z-index: 1000; background: #fff; border-radius: 6px; padding: 6px 0; min-width: 180px;
  box-shadow: 0 2px 6px 2px rgba(60, 64, 67, .15), 0 1px 2px rgba(60, 64, 67, .3); }
.sh-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; border: 0; background: none;
  padding: 6px 14px; font-size: 13px; text-align: left; cursor: pointer; color: #202124; }
.sh-item:hover { background: #f1f3f4; }
.sh-item.danger { color: #d93025; }
.sh-hint { color: #9aa0a6; font-size: 11px; }
.sh-sep { height: 1px; background: #e8eaed; margin: 4px 0; }
.sh-sink { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; pointer-events: none; }
.sm-head input[data-head] { border: 1px solid transparent; background: transparent; padding: 3px 6px; }
.sm-head input[data-head]:hover { border-color: #dadce0; }
.sm-head input[data-head]:focus { border-color: #1a73e8; background: #fff; outline: none; }

/* статичный график в справке (и на печати) */
.sg { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 12px; }
.sg-row { display: grid; grid-template-columns: 240px 150px 1fr; border-bottom: 1px solid var(--line); min-height: 26px; break-inside: avoid; }
.sg-row:last-child { border-bottom: 0; }
.sg-head { background: #f7f8fa; color: var(--muted); }
.sg-name, .sg-dates { padding: 4px 8px; border-right: 1px solid var(--line); }
.sg-dates { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sg-track { position: relative; }
.sg-month { position: absolute; top: 5px; padding-left: 3px; border-left: 1px solid var(--line); white-space: nowrap; }
.sg-mline { position: absolute; top: 0; bottom: 0; width: 1px; background: #eef0f3; }
.sg-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .45; }
.sg-bar { position: absolute; top: calc(50% - 6px); height: 12px; border-radius: 3px; background: var(--brand); min-width: 3px; }
.sg-bar.pt { width: 10px; height: 10px; top: calc(50% - 5px); margin-left: -5px; transform: rotate(45deg); border-radius: 1px; }
.sg-bar.own { background: #6c5ce7; }
.sg-bar.over { background: var(--bad); }
.sg-bar.done { background: var(--ok); }
.sg-bar.conf { outline: 2px dashed var(--bad); outline-offset: 1px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 6px 0 10px; }
.gallery figure { margin: 0; break-inside: avoid; }
.gallery img { width: 100%; height: 170px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
@media (max-width: 760px) { .sg { overflow-x: auto; } .sg-row { grid-template-columns: 150px 120px 420px; } .info-terms { grid-template-columns: 1fr !important; } }
@media print {
  header, footer.site, .noprint, .flash { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sg-row { grid-template-columns: 200px 130px 1fr; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .gallery img { height: 150px; }
  .info h3 { break-after: avoid; }
}
.g-fix { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-track { position: relative; min-height: 48px; }
.g-scale { min-height: 30px; }
.g-mline { position: absolute; top: 0; bottom: 0; width: 1px; background: #eef0f3; }
.g-month { position: absolute; top: 8px; font-size: 11px; color: var(--muted); padding-left: 4px; border-left: 1px solid var(--line); height: 22px; white-space: nowrap; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .45; z-index: 1; }
.g-bar { position: absolute; top: calc(50% - 9px); height: 18px; border-radius: 4px; background: var(--brand); z-index: 2; min-width: 4px; }
.g-bar.g-point { width: 14px !important; height: 14px; top: calc(50% - 7px); margin-left: -7px; border-radius: 2px; transform: rotate(45deg); }
.g-lbl { position: absolute; top: calc(50% - 8px); font-size: 11px; color: var(--muted); white-space: nowrap; z-index: 2;
         font-variant-numeric: tabular-nums; pointer-events: none; }
.g-lbl.left { transform: translateX(-100%); }
.g-bar.done { background: var(--ok); }
.g-bar.overdue { background: var(--bad); }
.g-bar.conflict { outline: 2px dashed var(--bad); outline-offset: 2px; }
.g-bar.moved:not(.done):not(.overdue) { background: #6c5ce7; }
.gantt.editable .g-bar { cursor: grab; touch-action: none; }
.gantt.editable .g-bar.dragging { cursor: grabbing; opacity: .8; }
.g-handle { position: absolute; right: -4px; top: -2px; bottom: -2px; width: 10px; cursor: ew-resize; border-radius: 3px; }
.g-handle.l { right: auto; left: -4px; }
.gantt.editable .g-bar:not(.g-point):hover .g-handle { background: rgba(255,255,255,.55); border: 1px solid var(--brand); }
.g-empty { position: absolute; left: 8px; top: calc(50% - 8px); font-size: 12px; color: var(--muted); }
.g-savebar { margin-top: 10px; padding: 10px 12px; background: var(--warn-soft); border-radius: 8px; }
.g-locked { margin-top: 10px; padding: 10px 12px; background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.danger-zone { border-color: #e7b4ae; }
.danger-zone h2 { color: var(--bad); }
#nmckrows { min-width: 520px; }
#nmckrows td { padding: 4px 6px 4px 0; }
#nmckrows input[name=nmck_name] { min-width: 260px; }
#nmckrows input[name=nmck_amount] { min-width: 160px; text-align: right; }
details.card.add > summary { margin-bottom: 0; }
details.card.add[open] > summary { margin-bottom: 12px; }

/* блоки на вкладке «Объекты» и вкладки-переключатели */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs .n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px;
           background: #eef0f3; font-size: 12px; text-align: center; color: var(--muted); }
h2 .n { font-weight: 400; color: var(--muted); font-size: 14px; }

/* ручной порядок сотрудников */
td.order { white-space: nowrap; }
td.order .btn.small { padding: 2px 8px; font-size: 13px; }
td.order .btn:disabled { opacity: .3; cursor: default; }
tr.moved td { background: var(--accent-soft); transition: background .6s; }

/* субподрядчики */
.kindlist { display: grid; gap: 2px; }
.kindlist a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--ink); font-size: 13px; }
.kindlist a:hover { background: var(--accent-soft); text-decoration: none; }
.kindlist a.on { background: var(--accent-soft); color: var(--brand); font-weight: 600; }
.kindlist .n { color: var(--muted); font-weight: 400; }
.kindgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; }
.stars { color: #e0a100; white-space: nowrap; letter-spacing: 1px; }
.stars .off { color: #d9dce1; }
.stars .half { background: linear-gradient(90deg, #e0a100 50%, #d9dce1 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.avg { margin-left: 4px; }
a.plain:hover { text-decoration: none; }
.review { padding: 10px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
/* выбор оценки звёздами: справа налево, чтобы подсвечивались все до выбранной */
.rate { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; }
.rate input { display: none; }
.rate label { font-size: 30px; line-height: 1; color: #d9dce1; cursor: pointer; padding: 0 2px; }
.rate label:hover, .rate label:hover ~ label, .rate input:checked ~ label { color: #e0a100; }
.rate #ratehint { order: -1; }
.bar { display: grid; grid-template-columns: 34px 1fr 24px; gap: 8px; align-items: center; margin: 4px 0; font-size: 13px; }
.bar .track { height: 8px; background: #eef0f3; border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; background: #e0a100; }

/* общий чат */
.chatbox { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 420px; padding: 0; overflow: hidden; }
.card.chatcard { padding: 0; overflow: hidden; }
.chatcard > h2 { margin: 0; padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.chatbox.chat-obj { height: 440px; min-height: 0; }
.chat-obj .msg { max-width: 88%; }
.chatfeed { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 10px; background: #f1f3f6; align-self: flex-start; }
.msg.mine { align-self: flex-end; background: var(--accent-soft); }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.msg .txt { white-space: pre-line; word-wrap: break-word; }
.chatform { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); background: #fafbfc; align-items: flex-end; }
.chatform textarea { min-height: 44px; flex: 1; }
@media (max-width: 760px) { .msg { max-width: 92%; } .chatbox { height: calc(100vh - 200px); } }

/* таблица этапов в форме договорника */
#stages { min-width: 620px; }
#stages td { padding: 6px 6px; }
#stages input[name=stage_name] { min-width: 240px; }
#stages input[type=date] { min-width: 150px; }
#stages input[name=stage_amount] { min-width: 130px; text-align: right; }

/* узкие экраны и телефоны */
@media (max-width: 760px) {
  header.top { height: auto; flex-wrap: wrap; gap: 6px 14px; padding: 8px 14px; }
  header.top .brand img { height: 32px; }
  header.top .brand span { display: none; }
  header.top nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  header.top nav a { white-space: nowrap; padding: 5px 10px; }
  main { padding: 14px; }
  .card { padding: 12px; }
  h1 { font-size: 19px; }
  dl.props { grid-template-columns: 110px 1fr; }
}
