/* цвета платформы — от темы сайта (светлая/тёмная); свои — только «отставание» и «выполнено» */
:root { --f-danger: #b4532f; --f-danger-soft: #fbeee8; --f-danger-line: #e5b7a4; --f-done: #c9d2ce; }
:root[data-theme="dark"] { --f-danger: #ec8d68; --f-danger-soft: #3a2621; --f-danger-line: #6e3f31; --f-done: #3e4a46; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --f-danger: #ec8d68; --f-danger-soft: #3a2621; --f-danger-line: #6e3f31; --f-done: #3e4a46; }
}
.f-workspace {
  max-width: 1500px;
  margin: auto;
  padding: 10px 8px 40px
}
.f-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 15px 0 30px
}
.f-eyebrow {
  font-size: 11px;
  letter-spacing: .13em;
  font-weight: 750;
  color: var(--muted)
}
.f-hero h1 {
  font-size: 38px;
  letter-spacing: -1.6px;
  margin: 12px 0
}
.f-hero p {
  color: var(--muted);
  max-width: 780px;
  line-height: 1.7
}
.f-hero.compact h1 {
  font-size: 34px
}
.f-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 24px 0
}
.f-stats article,
.f-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 5px 20px #173f2905
}
.f-stats article {
  padding: 25px
}
.f-stats span,
.f-stats small {
  display: block;
  color: var(--muted);
  font-size: 13px
}
.f-stats strong {
  display: block;
  font-size: 29px;
  letter-spacing: -1px;
  margin: 12px 0
}
.f-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0
}
.f-toolbar input {
  max-width: 420px;
  flex: 1
}
.f-toolbar select {
  max-width: 240px
}
.f-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px
}
.f-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--muted);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0
}
.f-badge.green {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--accent)
}
.f-panel {
  padding: 25px;
  margin: 22px 0
}
.f-panel h2 {
  font-size: 20px;
  margin: 0 0 15px
}
.f-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 16px
}
.f-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px
}
.f-two .f-panel {
  margin-bottom: 0
}
.f-owners {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 23px
}
.f-owners span,
.f-document small,
.f-variant small,
.f-table small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0
}
.f-owners b {
  font-size: 14px
}
.f-tabs {
  display: flex;
  gap: 5px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px
}
.f-tabs a {
  padding: 11px 16px;
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
  border-radius: 9px;
  font-size: 13px
}
.f-tabs a.active {
  background: var(--accent);
  color: var(--accent-ink)
}
.f-hero-amount {
  text-align: right;
  min-width: 200px
}
.f-hero-amount strong {
  display: block;
  font-size: 27px;
  margin-top: 10px
}
.f-hero-amount small {
  color: var(--muted)
}
.f-back {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none
}
.f-variant {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap
}
.f-variant>div:first-child {
  flex: 1;
  min-width: 220px
}
.f-variant h3 {
  margin: 10px 0;
  font-size: 17px
}
.f-variant>strong {
  font-size: 20px
}
.f-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap
}
.f-actions .btn {
  font-size: 12px;
  padding: 8px 10px
}
.f-scope>h3 {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 25px
}
.f-history {
  font-size: 12px;
  padding: 15px 0;
  color: var(--muted)
}
.f-document {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 18px 0
}
.f-empty {
  text-align: center;
  padding: 45px 22px;
  color: var(--muted);
  font-size: 14px
}
.f-empty>span {
  font-size: 35px;
  color: var(--accent)
}
.f-scroll {
  overflow: auto
}
.f-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}
.f-table th {
  font-size: 11px;
  color: var(--muted);
  text-align: left;
  padding: 12px 10px;
  background: var(--row)
}
.f-table td {
  padding: 15px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle
}
.f-table input {
  min-width: 100px;
  max-width: 140px
}
.f-checklist {
  padding-left: 20px;
  line-height: 2;
  font-size: 14px
}
.f-warn {
  color: var(--f-danger);
  font-size: 12px;
  display: block;
  margin-top: 7px
}
.f-timeline article {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  font-size: 13px
}
.f-timeline small {
  display: block;
  color: var(--muted);
  margin-top: 7px;
  font-size: 11px
}
.f-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 5px;
  flex-shrink: 0
}
.f-modal {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 20px;
  width: min(900px, 92vw);
  padding: 0;
  max-height: calc(90vh / var(--ui-zoom, 1));
  box-shadow: 0 24px 100px #0003
}
.f-modal::backdrop {
  background: #132a2480
}
.f-modal header,
.f-modal footer {
  padding: 20px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--line)
}
.f-modal h2 {
  margin: 0;
  font-size: 21px
}
.f-fields {
  padding: 22px 25px;
  display: grid;
  gap: 14px 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  overflow-y: auto;
  max-height: calc(calc(90vh / var(--ui-zoom, 1)) - 150px)
}
/* поля в две колонки на широком экране; текст, пояснения, таблицы и галочки — во всю ширину */
.f-fields > :not(label),
.f-fields > label:has(textarea),
.f-fields > label.f-checkbox,
.f-fields > label:has(input[type=checkbox]) {
  grid-column: 1 / -1
}
.f-fields label {
  display: grid;
  gap: 7px;
  font-size: 13px
}
.f-fields input,
.f-fields select {
  width: 100%
}
.f-fields .f-checkbox {
  display: flex;
  align-items: center
}
.f-checkbox input {
  width: auto
}
.f-fields fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
  display: grid;
  gap: 10px
}
.f-modal footer {
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--surface)
}
.f-close {
  border: 0;
  background: none;
  color: inherit;
  font-size: 27px;
  cursor: pointer
}
.f-error {
  color: var(--f-danger);
  padding: 0 25px 15px;
  font-size: 14px
}
.f-callout {
  background: var(--accent-soft);
  padding: 18px;
  border-radius: 10px;
  color: var(--ink)
}
.f-bridge {
  background: var(--accent-soft);
  padding: 14px;
  border-radius: 10px;
  margin: 0 0 15px;
  display: flex;
  gap: 20px;
  color: var(--ink);
  font-size: 13px
}
.f-bridge a {
  font-weight: 700;
  color: inherit
}
@media(max-width:1000px) {
  .f-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }
  .f-two {
    grid-template-columns: 1fr
  }
  .f-hero h1 {
    font-size: 30px
  }
  .f-stats strong {
    font-size: 23px
  }
}
@media(max-width:640px) {
  .f-grid,
.f-stats {
    grid-template-columns: 1fr
  }
  .f-hero {
    align-items: flex-start;
    flex-direction: column
  }
  .f-toolbar {
    flex-wrap: wrap
  }
  .f-hero-amount {
    text-align: left
  }
  .f-document {
    flex-wrap: wrap
  }
  .f-panel {
    padding: 17px
  }
  .f-panel-head {
    align-items: flex-start;
    flex-direction: column
  }
  .f-variant {
    gap: 12px
  }
  .f-owners {
    grid-template-columns: 1fr
  }
  .f-stats article {
    padding: 20px
  }
  .f-bridge {
    flex-wrap: wrap
  }
}
.f-panel,
.f-stats article,
.f-modal,
.f-modal footer {
  background: var(--surface)
}
body[data-page=deal] .production-heading {
  margin-top: 22px
}
@media print {
  .f-back,
.f-hero,
.f-tabs,
.f-toolbar {
    display: none !important
  }
}
/* Operations workspace: clear hierarchy,
one strip per object. */
/* Operations workspace: clear hierarchy,
one strip per object. */
.wf-subtabs,
.wf-segment {
  display: flex;
  gap: 5px;
  flex-wrap: wrap
}
.wf-subtabs {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px
}
.wf-subtabs button,
.wf-segment button {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 9px;
  padding: 10px 15px;
  cursor: pointer;
  font: inherit;
  font-size: 13px
}
.wf-subtabs button.on,
.wf-segment button.on {
  background: var(--accent);
  color: var(--accent-ink)
}
.wf-subtabs span {
  opacity: .65;
  margin-left: 8px
}
.wf-segment {
  background: var(--row);
  border-radius: 12px;
  padding: 4px;
  flex-shrink: 0
}
.wf-deal-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 20px;
  text-decoration: none !important;
  color: var(--ink);
  box-shadow: 0 4px 14px #123c2205
}
.wf-deal-card:hover {
  border-color: var(--accent)
}
.wf-deal-card h3 {
  font-size: 19px;
  margin: 12px 0
}
.wf-deal-card p {
  font-size: 13px;
  line-height: 1.6
}
.wf-deal-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7
}
.wf-deal-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
  font-size: 12px
}
.wf-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 8px 0 20px;
  align-items: stretch
}
.wf-column {
  flex: 0 0 270px;
  background: var(--row);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 15px;
  min-height: 320px
}
.wf-column>h3 {
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  margin: 5px 0 20px
}
.wf-column>h3 span {
  background: var(--surface);
  border-radius: 7px;
  padding: 2px 8px
}
.wf-column .wf-deal-card {
  margin-bottom: 12px
}
.wf-late {
  color: var(--f-danger);
  font-weight: 700;
  font-size: 12px
}
.wf-deal-card.is-late {
  border-left: 4px solid var(--f-danger)
}
.wf-phase-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px
}
.wf-phase-cards article {
  border: 1px solid var(--line);
  border-top: 4px solid var(--phase);
  border-radius: 12px;
  padding: 18px
}
.wf-phase-cards small {
  font-size: 10px;
  color: var(--muted)
}
.wf-phase-cards h3 {
  font-size: 17px;
  margin: 14px 0
}
.wf-phase-cards p {
  font-size: 12px
}
.wf-work-details>summary {
  cursor: pointer;
  font-weight: 600;
  padding: 18px;
  background: var(--row);
  border-radius: 12px
}
@media(max-width:700px) {
  .wf-column {
    flex-basis: 250px
  }
}
/* ================= ГПР: компактный график,
список,
канбан ================= */
/* ================= ГПР: компактный график,
список,
канбан ================= */
.gpr { gap: 12px; }
.gpr-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.gpr-head h1 { font-size: 26px; line-height: 1.15; margin: 0 0 6px; }
.gpr-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.gpr-stats > * { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.gpr-stats b { color: var(--ink); font-weight: 700; }
.gpr-stat-late { cursor: pointer; font: inherit; }
.gpr-stat-late b { color: var(--f-danger); }
.gpr-stat-late.on { background: var(--f-danger-soft); border-color: var(--f-danger-line); color: var(--f-danger); }
.gpr-stat-late:disabled { cursor: default; opacity: .6; }
.gpr-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gpr-bar input[type=search] { width: 210px; }
.gpr-bar select { width: auto; }
.gpr-bar .gpr-sp { flex: 1; }
#gprChartTools { display: inline-flex; gap: 8px; align-items: center; }
.gpr-zoom button { padding: 6px 10px; }
.gpr-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.gpr-legend span { display: inline-flex; align-items: center; gap: 5px; }
.gpr-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.gpr-legend i.done { background: var(--f-done); }
.gpr-legend i.late { background: transparent; border: 2px solid var(--f-danger); width: 8px; height: 8px; }
.gpr-scroll { overflow: auto; max-height: calc(calc(100vh / var(--ui-zoom, 1)) - 290px); min-height: 220px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; overscroll-behavior: contain; }
.gpr-grid { width: var(--w); position: relative; }
.gpr-scale { position: sticky; top: 0; z-index: 3; height: 42px; background: var(--surface); border-bottom: 1px solid var(--line); }
.gpr-months span { position: absolute; top: 0; height: 22px; line-height: 22px; padding-left: 6px; box-sizing: border-box;
  border-left: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; }
.gpr-ticks span { position: absolute; top: 23px; font-size: 10px; color: var(--muted); transform: translateX(2px); }
.gpr-rows { position: relative; }
.gpr-bg { position: absolute; top: 0; bottom: 0; left: 0; width: var(--w); pointer-events: none; z-index: 0; }
.gpr-bg i { position: absolute; top: 0; bottom: 0; background: rgba(120, 130, 125, .06); }
.gpr-bg b { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.gpr-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--f-danger); z-index: 1; }
.gpr-today span { position: absolute; top: 2px; left: 4px; font-size: 10px; font-weight: 700; color: var(--f-danger); white-space: nowrap; }
/* строка объекта: подпись сверху (прилипает к левому краю),
этапы под ней */
.gpr-row { display: block; position: relative; z-index: 1; height: 46px; width: var(--w); border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit; }
.gpr-row.lanes2 { height: 60px; }
.gpr-row.lanes3 { height: 74px; }
.gpr-row:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.gpr-row.is-done .gpr-label { opacity: .6; }
.gpr-label { position: sticky; left: 6px; z-index: 2; display: inline-flex; align-items: baseline; gap: 6px; max-width: 70vw;
  margin-top: 2px; padding: 0 4px; height: 16px; line-height: 16px; white-space: nowrap; border-radius: 4px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); }
.gpr-label b { font-size: 12px; font-weight: 650; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.gpr-label small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.gpr-label .gpr-late { padding: 0 5px; line-height: 14px; }
.gpr-bar-ph { position: absolute; z-index: 1; box-sizing: border-box; border-radius: 5px; background: var(--ph);
  top: calc(20px + var(--lane) * (100% - 25px) / var(--lanes)); height: calc((100% - 25px) / var(--lanes) - 2px);
  display: flex; align-items: center; overflow: hidden; font-style: normal; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.gpr-bar-ph em { font-style: normal; font-size: 11px; font-weight: 600; color: #fff; padding: 0 6px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.gpr-bar-ph.done { background: color-mix(in srgb, var(--ph) 28%, var(--f-done)); }
.gpr-bar-ph.done em { color: var(--ink); text-shadow: none; }
.gpr-bar-ph.active { box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 0 0 2px color-mix(in srgb, var(--ph) 35%, transparent); }
.gpr-bar-ph.late { box-shadow: inset 0 0 0 2px var(--f-danger); }
.gpr-zoom-step { display: inline-flex; gap: 2px; }
.gpr-zoom-step .btn { min-width: 30px; padding-left: 0; padding-right: 0; font-weight: 700; }
.gpr-late { display: inline-block; padding: 1px 6px; border-radius: 6px; background: var(--f-danger-soft); color: var(--f-danger);
  font-size: 11px; font-weight: 700; white-space: nowrap; }
.gpr-list td { padding-top: 7px; padding-bottom: 7px; vertical-align: middle; }
.gpr-list .nowrap { white-space: nowrap; }
.gpr-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; margin: 1px 0;
  background: color-mix(in srgb, var(--ph) 16%, transparent); border-left: 3px solid var(--ph); }
.gpr-steps { display: inline-flex; gap: 2px; }
.gpr-steps i { width: 14px; height: 8px; border-radius: 2px; background: color-mix(in srgb, var(--ph) 22%, transparent); }
.gpr-steps i.done { background: color-mix(in srgb, var(--ph) 55%, var(--f-done)); }
.gpr-steps i.active { background: var(--ph); }
.gpr-steps i.late { outline: 2px solid var(--f-danger); outline-offset: -1px; }
.gpr-board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; align-items: flex-start; }
.gpr-col { flex: 0 0 236px; background: var(--row); border: 1px solid var(--line); border-radius: 12px;
  border-top: 3px solid var(--ph); display: flex; flex-direction: column; max-height: calc(calc(100vh / var(--ui-zoom, 1)) - 280px); }
.gpr-col.late { background: var(--f-danger-soft); border-color: var(--f-danger-line); border-top-color: var(--f-danger); }
.gpr-col.done { opacity: .75; }
.gpr-col h3 { display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 9px 10px 7px;
  font-size: 13px; font-weight: 650; }
.gpr-col h3 b { font-size: 12px; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 1px 8px; }
.gpr-col-body { overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 6px; }
.gpr-card { display: grid; grid-template-columns: 1fr auto; column-gap: 6px; padding: 7px 9px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ph);
  text-decoration: none; color: inherit; }
.gpr-card:hover { border-color: var(--accent); }
.gpr-card b { font-size: 13px; font-weight: 650; line-height: 1.3; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gpr-card small { grid-column: 1; font-size: 11px; color: var(--muted); line-height: 1.35; }
.gpr-card .gpr-late { grid-row: 1; grid-column: 2; align-self: start; }
.gpr-card.is-late { border-left-color: var(--f-danger); }
@media (max-width: 700px) {
  .gpr-head h1 { font-size: 22px; }
  .gpr-bar input[type=search] { width: 100%; }
  .gpr-bar select { flex: 1 1 40%; min-width: 0; }
  .gpr-bar .wf-segment { width: 100%; }
  .gpr-bar .wf-segment button { flex: 1; }
  #gprChartTools { width: 100%; flex-wrap: wrap; }
  #gprChartTools .gpr-zoom { min-width: 0; }
  .gpr-zoom { flex: 1; flex-wrap: nowrap; }
  .gpr-zoom button { padding: 6px 6px; font-size: 13px; }
  .gpr-legend { display: none; }
  .gpr-label small { display: none; }
  .gpr-bar .gpr-sp { display: none; }
  .gpr-zoom button { padding: 6px 8px; }
  .gpr-scroll { max-height: calc(calc(100vh / var(--ui-zoom, 1)) - 300px); }
  .gpr-col { flex-basis: 78vw; scroll-snap-align: start; }
  .gpr-board { scroll-snap-type: x mandatory; }
}

/* появление содержимого при смене раздела/вида — та же анимация, что у страниц (theme.css: rise) */
.f-anim > * { animation: rise .45s cubic-bezier(.22, .8, .25, 1) both; }
@media (prefers-reduced-motion: reduce) { .f-anim > * { animation: none; } }

/* ================= Сделки: список, карточки, канбан ================= */
.dl { gap: 12px; }
.dl .wf-subtabs { margin: 0; }
.dl-filters select { max-width: 220px; }
.dl-filters .btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }

.dl-table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.dl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dl-table th { position: sticky; top: 0; z-index: 1; background: var(--row); text-align: left; font-size: 11px; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 9px 12px; white-space: nowrap; cursor: pointer;
  user-select: none; border-bottom: 1px solid var(--line); }
.dl-table th:hover { color: var(--ink); }
.dl-table th.on { color: var(--accent); }
.dl-table th.on::after { content: '↓'; margin-left: 4px; }
.dl-table th.on.asc::after { content: '↑'; }
.dl-table th.num, .dl-table td.num { text-align: right; }
.dl-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.dl-table tbody tr { cursor: pointer; transition: background .12s; }
.dl-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.dl-table tbody tr:last-child td { border-bottom: 0; }
.dl-table td small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.dl-obj { max-width: 320px; }
.dl-obj a { font-weight: 650; color: var(--ink); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; }
.dl-obj a:hover { color: var(--accent); }
.dl-obj small { overflow: hidden; text-overflow: ellipsis; }
.dl-sum { font-variant-numeric: tabular-nums; font-weight: 650; }

/* стадия: цветная метка + подпись */
.dl-stage { display: inline-grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center; }
.dl-stage i { width: 8px; height: 8px; border-radius: 50%; background: var(--ph); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ph) 22%, transparent); }
.dl-stage b { font-weight: 600; }
.dl-stage small { grid-column: 2; }
.dl-stage.pre, .dl-stage.muted { grid-template-columns: 1fr; }
.dl-stage.pre small, .dl-stage.muted small { grid-column: 1; }
.dl-stage.muted b, .dl-stage.muted { color: var(--muted); }
.dl-stage.done b { color: var(--muted); }

/* ход стройки: сегменты этапов */
.dl-steps { display: inline-flex; align-items: center; gap: 8px; }
.dl-seg { display: inline-flex; gap: 3px; }
.dl-seg i { width: 18px; height: 7px; border-radius: 4px; background: color-mix(in srgb, var(--ph) 20%, transparent);
  transition: transform .15s; cursor: help; }
.dl-seg i:hover { transform: scaleY(1.6); }
.dl-seg i.done { background: color-mix(in srgb, var(--ph) 60%, var(--f-done)); }
.dl-seg i.active { background: var(--ph); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ph) 30%, transparent);
  animation: dl-pulse 2.4s ease-in-out infinite; }
.dl-seg i.late { box-shadow: 0 0 0 2px var(--f-danger); }
.dl-steps small { font-size: 11px; color: var(--muted); margin: 0 !important; display: inline !important; }
.dl-steps.wide .dl-seg { flex: 1; }
.dl-steps.wide .dl-seg i { flex: 1; width: auto; }
@keyframes dl-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ph) 18%, transparent); } }

/* оплата: принятое по актам — подложкой, поступившее — поверх */
.dl-paid { display: inline-flex; flex-direction: column; gap: 3px; min-width: 110px; cursor: help; }
.dl-bar { position: relative; height: 6px; border-radius: 4px; background: var(--row); overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line); }
.dl-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); }
.dl-bar i.acc { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.dl-paid.debt .dl-bar i.acc { background: color-mix(in srgb, var(--f-danger) 35%, transparent); }
.dl-paid small { margin: 0 !important; }
.dl-paid.debt small { color: var(--f-danger); font-weight: 600; }

.dl-person { display: inline-flex; align-items: center; gap: 7px; }
.dl-person i { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal;
  font-size: 10px; font-weight: 700; color: var(--accent); background: var(--accent-soft); flex: none; }
.dl-person span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

/* карточки */
.dl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.dl-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line); border-top: 3px solid var(--ph); text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s; }
.dl-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .25); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.dl-card.is-late { border-top-color: var(--f-danger); }
.dl-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dl-card h3 { margin: 0; font-size: 16px; line-height: 1.25; }
.dl-card p { margin: -4px 0 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-card .dl-stage { font-size: 13px; }
.dl-card .dl-stage small { font-size: 11px; color: var(--muted); }
.dl-card footer { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); display: flex; justify-content: space-between;
  align-items: center; gap: 10px; font-size: 13px; }
.dl-card footer .dl-paid { min-width: 120px; }
.gpr-card .dl-steps { grid-column: 1 / -1; margin-top: 4px; }

/* всплывающая подсказка (одна на страницу) */
.f-tip { position: fixed; z-index: 1000; max-width: 280px; padding: 6px 9px; border-radius: 8px; font-size: 12px; line-height: 1.35;
  background: var(--hdr, #1e2a27); color: var(--hdr-ink, #e6edea); box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .35);
  pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.f-tip.on { opacity: 1; transform: none; }
.f-tip::after { content: ''; position: absolute; left: var(--ax, 50%); bottom: -4px; width: 8px; height: 8px; margin-left: -4px;
  background: inherit; transform: rotate(45deg); }
.f-tip.below::after { bottom: auto; top: -4px; }
@media (prefers-reduced-motion: reduce) { .dl-seg i.active { animation: none; } }
@media (max-width: 700px) {
  .dl-filters select { max-width: none; flex: 1 1 45%; }
  .dl-cards { grid-template-columns: 1fr; }
}
.dl-filters [hidden] { display: none !important; }
.dl .wf-subtabs { margin-top: 4px; }
.dl-card { min-width: 0; }
.dl-steps.wide { display: flex; width: 100%; }

/* «Дата в документах» на вкладках «Смета» и «КП» */
.doc-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.doc-date input { width: auto; padding: 4px 8px; }

/* плашка типового проекта */
.typ-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 4px;
  padding: 10px 14px; border-radius: 12px; background: var(--osb-soft, var(--accent-soft)); border: 1px solid var(--line); font-size: 13px; }
.typ-bar.editor { background: var(--accent-soft); }
.typ-bar #typDraftHint { color: var(--f-danger); font-weight: 600; }

/* ================= оформление: наведение в меню, главная кнопка, выбранный раздел ================= */
/* меню: при наведении — только подсветка фона, цвет текста свой (в светлой теме был светлый на светлом) */
nav.main a:hover { color: inherit; }

/* главная кнопка в тёмной теме — глубокий зелёный с мягким градиентом вместо кислотной заливки */
:root[data-theme="dark"] .btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--acc, var(--accent)) 62%, #0b1411), color-mix(in srgb, var(--acc, var(--accent)) 42%, #0b1411));
  border-color: color-mix(in srgb, var(--acc, var(--accent)) 55%, transparent); color: #effaf4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 18px -10px color-mix(in srgb, var(--acc, var(--accent)) 70%, transparent);
}
:root[data-theme="dark"] .btn.primary:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--acc, var(--accent)) 72%, #0b1411), color-mix(in srgb, var(--acc, var(--accent)) 50%, #0b1411));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 10px 26px -12px var(--acc, var(--accent));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary {
    background: linear-gradient(180deg, color-mix(in srgb, var(--acc, var(--accent)) 62%, #0b1411), color-mix(in srgb, var(--acc, var(--accent)) 42%, #0b1411));
    border-color: color-mix(in srgb, var(--acc, var(--accent)) 55%, transparent); color: #effaf4;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 18px -10px color-mix(in srgb, var(--acc, var(--accent)) 70%, transparent);
  }
  :root:not([data-theme="light"]) .btn.primary:hover {
    background: linear-gradient(180deg, color-mix(in srgb, var(--acc, var(--accent)) 72%, #0b1411), color-mix(in srgb, var(--acc, var(--accent)) 50%, #0b1411));
  }
}

/* вкладки разделов (карточка сделки, «До договора / Договоры …»): линия снизу вместо заливки */
.f-tabs { gap: 2px; padding-bottom: 0; }
.f-tabs a, .wf-subtabs button {
  position: relative; border-radius: 8px 8px 0 0; color: var(--muted); background: transparent; padding: 11px 14px 12px;
  transition: color .15s, background .15s;
}
.f-tabs a:hover, .wf-subtabs button:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.f-tabs a::after, .wf-subtabs button::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--acc3, var(--accent)), var(--acc, var(--accent)));
  transform: scaleX(0); transition: transform .2s cubic-bezier(.22, .8, .25, 1);
}
.f-tabs a.active, .wf-subtabs button.on { background: transparent; color: var(--ink); font-weight: 650; }
.f-tabs a.active::after, .wf-subtabs button.on::after { transform: scaleX(1); }
.wf-subtabs { padding-bottom: 0; gap: 2px; }
.wf-subtabs span { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; font-size: 11px; line-height: 18px;
  background: var(--row); opacity: 1; color: var(--muted); }
.wf-subtabs button.on span { background: var(--accent-soft); color: var(--accent); }

/* переключатели вида (Список/Карточки/Канбан, График/…, масштаб): выбранная кнопка «приподнята» на подложке */
.wf-segment { background: var(--row); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.wf-segment button { color: var(--muted); padding: 7px 13px; border-radius: 8px; transition: color .15s, background .15s, box-shadow .15s; }
.wf-segment button:hover { color: var(--ink); }
.wf-segment button.on {
  background: var(--surface); color: var(--ink); font-weight: 650;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 8px -4px rgba(0, 0, 0, .18), inset 0 0 0 1px var(--line);
}
:root[data-theme="dark"] .wf-segment button.on { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wf-segment button.on { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
}

/* ================= масштаб интерфейса: 85% на компьютере (решение руководителя), на телефоне — обычный =================
   высоты от окна (vh) делятся на масштаб, чтобы блоки по-прежнему занимали окно целиком */
@media (min-width: 701px) {
  :root { --ui-zoom: .85; }
  html { zoom: var(--ui-zoom); }
}

/* появление страниц и разделов без «подёргивания» в конце: только прозрачность и сдвиг (без размытия, из-за которого текст
   перерисовывался в последний момент), на отдельном слое до конца — без перескока на пиксельную сетку */
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
#app > *, #tab > *, .f-anim > * { backface-visibility: hidden; }
