

.pf-cards { display: none; }

.cat-bundles-toggle { display: none; }

.pf-edit-corner { display: none; }

.hdr-vat-mini { display: none; }
.hdr-short { display: none; }
.pf-card {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 11px;
  background: #f6f8fa;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  min-width: 0;
}
.pf-card-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pf-card-fact {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
}
.pf-card-plan {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pf-cards-edit {
  grid-column: 1 / -1;
  justify-self: start;
  margin: 2px 0 0;
  font-size: 0.78rem !important;
  color: var(--text-tertiary);
}

@media (max-width: 950px) {

  .app-content,
  .app-content:has(#overview-page.active),
  .app-content:has(#report-page.active) {
    max-width: none;
    padding: 10px 10px 40px;
  }

  :root { --app-header-h: 100px; }

  html {
    height: 100%;
    overflow: hidden;
  }
  body {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
    display: flex;
    flex-direction: column;
    padding-top: 0;
  }
  .app-header {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 14px;
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    flex: 0 0 auto;
    z-index: 100;
  }

  .app-content {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .app-header-logo { flex: 0 1 auto; min-width: 0; }
  .app-header-logo svg { height: 32px; }
  .app-header h1 { font-size: 1rem; }

  .nav-tabs {
    order: 5;
    flex: 1 0 100%;
    width: 100%;
    justify-content: stretch;
    padding: 2px;
  }
  .nav-tabs label {
    flex: 1 1 0;
    text-align: center;
    padding: 5px 8px;
    font-size: 0.82rem;
  }

  .app-header > .overview-filters {
    position: static;
    order: 6;
    flex: 1 0 100%;
    width: auto;
    margin: 0 -14px -10px;
    padding: 0 12px 9px;
    gap: 6px;
    row-gap: 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    flex-wrap: nowrap;
  }

  .overview-filters {
    position: static;
    top: auto;
    margin: 0 0 12px;
    padding: 0 0 6px;
    gap: 6px;
    row-gap: 6px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    flex-wrap: nowrap;
  }
  .overview-filters label {
    font-size: 0.74rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
  }
  .overview-filters select {
    font-size: 0.85rem;
    padding: 6px 24px 6px 10px;
  }

  .overview-filters { --ov-ctl-h: 28px; }

  .ov-cselect-btn {
    font-size: 0.82rem;
    padding-left: 8px;
    padding-right: 18px;
  }
  .overview-filters .ov-cselect-btn { width: 88px; }
  .ov-cselect-menu { min-width: 120px; }
  .ov-settings-wrap { margin-left: 0; }
  .ov-settings-btn { padding-left: 9px; padding-right: 9px; font-size: 0.78rem; }
  .ov-settings-txt { display: none; }
  .ov-settings-ic { font-size: 0.95rem; line-height: 1; }

  .ov-settings-popup { min-width: 200px; right: 0; left: auto; max-width: calc(100vw - 20px); }

  .pt-btn { padding-left: 8px; padding-right: 8px; font-size: 0.58rem; }

  .category-block {
    padding: 12px 3px;
    margin-bottom: 16px;
  }
  .category-title {
    font-size: 1.05rem;
    margin-bottom: 12px;
  }

  .pf-cards { display: none; }
  .plan-fact-block { max-width: 100%; overflow-x: auto; margin-bottom: 4px; }

  .ut-pause { color: var(--text-tertiary); font-size: 0.82em; opacity: 0.7; }
  .plan-fact-table { display: table; width: 100%; font-size: 0.72rem; }

  .category-title { margin-bottom: 0; }

  .plan-fact-table th.pf-num,
  .plan-fact-table td.pf-num { padding: 3px 6px; min-width: 0; }
  .plan-fact-table th.pf-label,
  .plan-fact-table td.pf-label { padding: 3px 4px; }

  .plan-fact-table td.pf-label { text-align: right; padding-right: 2px; }
  .plan-fact-table th.pf-label { padding-right: 2px; }
  .plan-fact-table th.pf-num:first-of-type,
  .plan-fact-table td.pf-num:first-of-type { padding-left: 3px; }

  .plan-fact-table tr > th.pf-num:last-child,
  .plan-fact-table tr > td.pf-num:last-child { padding-right: 9px; }

  .pf-edit-inline { display: none; }
  .pf-edit-corner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
  }

  .plan-fact-table .pf-grp {
    border-left: 1px solid rgba(236, 58, 57, 0.30);
    padding-left: 6px;
  }

  .plan-fact-table tr > th.pf-num:last-child,
  .plan-fact-table tr > td.pf-num:last-child {
    border-right: 1px solid rgba(236, 58, 57, 0.30);
  }

  .plan-fact-table .pf-row-plan td.pf-num,
  .plan-fact-table .pf-row-plan td.pf-label {
    border-bottom: 1px solid rgba(236, 58, 57, 0.30);
  }
  .pf-row-fact td { font-size: 0.85rem; }
  .pf-row-fact td.pf-label { font-size: 0.72rem; }
  .pf-row-plan td { font-size: 0.72rem; }
  .pf-row-plan td.pf-label { font-size: 0.7rem; }
  .plan-fact-block .pf-edit-form { margin-top: 10px; }
  .plan-fact-block .pf-edit-form input { width: 100px; }

  .ut-sticky-col {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
  }
  .unified-table { font-size: 0.7rem; }

  .unified-table th,
  .unified-table td { padding: 4px 3px 4px 2px; }

  .unified-table .ut-num { padding-right: 7px; padding-left: 4px; }

  body.tq-mode .unified-table { font-size: 0.62rem; }
  body.tq-mode .unified-table .ut-num { padding-right: 4px; padding-left: 2px; }
  body.tq-mode .ut-sticky-col { width: 84px; min-width: 84px; max-width: 84px; }

  .unified-table th.ut-monthly-group {
    border-bottom: 1px solid rgba(236, 58, 57, 0.28);
  }
  .unified-table th.ut-monthly-subcol {
    border-bottom: 2px solid rgba(236, 58, 57, 0.28);

    padding-left: 5px;
    padding-right: 5px;
  }

  .ut-num { font-size: 0.6rem; letter-spacing: -0.2px; }

  .ut-week-gap { width: 12px; min-width: 12px; max-width: 12px; }

  .ut-week-gap-first { width: 8px; min-width: 8px; max-width: 8px; }

  .unified-table th.ut-week-current,
  .unified-table th.ut-week-collapsed-marker.ut-week-current {
    color: var(--brand-color);
    font-weight: 600;
    background: rgba(236, 58, 57, 0.08);
    border-color: rgba(236, 58, 57, 0.35) !important;
  }

  .unified-table th.ut-week-collapsed-marker {
    width: 22px; min-width: 22px; max-width: 22px;
    border-radius: 7px;
  }

  .ut-monthly-group { border-right-width: 1px; }
  .ut-bundle-name { font-size: 0.72rem; cursor: pointer; }
  .bundle-name-link { -webkit-tap-highlight-color: rgba(236, 58, 57, 0.18); }

  .unified-table col.ut-mcol-grp { border-left: 1px solid rgba(236, 58, 57, 0.28); }

  .unified-table tfoot .row-plan td,
  .unified-table tfoot .row-plan th {
    border-left-style: hidden;
    border-right-style: hidden !important;
  }

  .unified-table td.ut-num.ut-total-separator,
  .unified-table th.ut-monthly-subcol.ut-total-separator { padding-right: 8px; }
  .unified-table td.ut-num.ut-total-separator,
  .unified-table th.ut-monthly-subcol.ut-total-separator,
  .unified-table th.ut-monthly-group.ut-total-separator {
    border-right: 1px solid rgba(236, 58, 57, 0.28) !important;
  }

  .ut-plan-label,
  .ut-total-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .unified-table tfoot .row-plan td,
  .unified-table tfoot .row-plan .ut-plan-cell,
  .unified-table tfoot .row-plan .ut-plan-label,
  .row-plan .wp-input { font-size: 0.5rem !important; }

  .unified-table tfoot .row-total .ut-num,
  .unified-table tfoot .row-total .ut-total-label { font-size: 0.64rem; }

  .hdr-full { display: none; }
  .hdr-short { display: inline; }

  .hdr-vat-full { display: none; }
  .hdr-vat-mini {
    display: inline;
    font-size: 0.5rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0;
    margin-left: 2px;
  }

  .cat-bundles-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 4px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--brand-color);
    background: var(--brand-color-dim);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(236, 58, 57, 0.18);
  }

  .category-block:not(.bundles-collapsed) .cat-bundles-toggle { margin-bottom: 14px; }
  .cat-bundles-toggle .cbt-chev { transition: transform 0.2s ease; }
  .category-block:not(.bundles-collapsed) .cat-bundles-toggle .cbt-chev {
    transform: rotate(180deg);
  }
  .category-block.bundles-collapsed .unified-scroll-container { display: none; }

  .report-filters {
    padding: 8px 0 12px;
    gap: 6px;
  }
  .report-select { min-width: 0; font-size: 0.8rem; padding: 6px 24px 6px 10px; }
  .report-groupings-btn,
  .report-filter-btn { font-size: 0.8rem; padding: 6px 10px; }
  .report-filters .ov-export-btn { padding: 6px 8px; }

  .report-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
  }
  .report-groupings-btn { margin-left: 0; }
  .report-filters .ov-export-btn { margin-left: 0; }

  .report-period {
    order: -1;
    flex: 1 0 100%;
    display: block;
  }
  .report-date-btn {
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
    padding: 8px 12px;
  }
  .report-period-pop {
    left: 0;
    right: auto;
    min-width: 0;
    width: min(340px, 94vw);
    max-width: 94vw;
  }

  .rp-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-preset { min-width: 0; white-space: nowrap; }

  .rt-th:first-child,
  .rt-td:first-child {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
  }
  .rt-table { font-size: 0.8rem; }

  .rt-td-namepop { cursor: pointer; -webkit-tap-highlight-color: rgba(236, 58, 57, 0.18); }

  .mp-panel, .fp-panel { padding: 14px; }
  .mp-columns, .fp-columns { flex-direction: column; gap: 16px; }
  .mp-left, .mp-right,
  .fp-left, .fp-right {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  .mp-active-metrics { width: 100%; }
  .mp-metric-chip { max-width: 100%; }
}

@media (max-width: 360px) {
  .pf-card { padding: 8px 9px; }
  .pf-card-fact { font-size: 1.08rem; }
  .app-content { padding: 8px 8px 40px; }
}

@media (max-width: 385px) {
  .plan-fact-table th.pf-num,
  .plan-fact-table td.pf-num { padding-left: 4px; padding-right: 4px; }
  .plan-fact-table .pf-grp { padding-left: 4px; }
}

@media (min-width: 701px) and (max-width: 950px) {
  .app-header { flex-wrap: nowrap; }
  .nav-tabs {
    order: 0;
    flex: 0 1 auto;
    width: auto;
  }
}


@media (max-width: 700px) {
  /* Первая строка шапки — логотип застройщика, метка стенда и вордмарк
     студии в один ряд. Раньше вордмарк не влезал по ширине и переносился
     на собственную строку, съедая высоту и разрывая шапку пополам.
     Поэтому: логотип чуть мельче, блок логотипа умеет сжиматься, а
     вордмарк — нет (он и так самый узкий). */
  .app-header-logo {
    flex: 0 1 auto;
    min-width: 0;
    align-items: center;
  }
  .app-header-logo svg { height: 28px; }
  .mk-wordmark {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: center;
  }
}
