/* PATRIOT theme — synced with petrpatriot.ru/actions/ (patriot-actions static) */
/* Local variable font: preloaded by index.html to keep text metrics stable. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/manrope-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --orange: #ff5100;
  --orange-dark: #e04800;
  --orange-soft: #fff5f0;
  --gray: #494c4e;
  --gray-mid: #717171;
  --gray-light: #b4b4b4;
  --white: #ffffff;
  --bg: #ffffff;
  --cut: 32px;
  --radius: 12px;
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 4px 24px rgba(73, 76, 78, 0.08);
  --max: 100%;
  --dashboard-header-height: 49px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--gray);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-top: var(--dashboard-header-height);
}

.hidden {
  display: none !important;
}

.chamfer {
  clip-path: polygon(
    0 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% 100%,
    0 100%
  );
}

/* Site header — fixed global bar: logo | MP tabs | calendar | actions */
.site-header {
  background: var(--white);
  border-bottom: 1px solid #eee;
  padding: 3px 0;
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.site-header[data-mp-scope]:not([data-mp-scope="all"]) {
  border-bottom-color: rgba(255, 81, 0, 0.35);
  box-shadow: 0 2px 10px rgba(255, 81, 0, 0.1);
}

.site-header-inner {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px 8px;
  flex-wrap: nowrap;
}

.site-logo {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
  border-radius: 6px;
  transition: opacity 0.15s;
}

.site-logo:hover {
  opacity: 0.85;
}

.site-header img {
  height: 20px;
  width: auto;
  flex: 0 0 auto;
}

.site-header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray);
  line-height: 1.35;
  flex: 1;
  min-width: 200px;
}

.header-actions {
  margin-left: auto;
  flex: 0 0 auto;
}

/* MP filter in header */
.header-mp-scope {
  flex: 0 1 auto;
  min-width: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.header-mp-scope .global-mp-scope-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.header-mp-scope .global-mp-scope-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.header-mp-scope .global-mp-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

.header-mp-scope .global-mp-chip {
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.header-mp-scope .global-mp-chip.active {
  box-shadow: 0 1px 4px rgba(255, 81, 0, 0.35);
}

.header-mp-scope .only-wb-toggle {
  display: none;
}

/* Matrix controls stay in the same thin sticky header as the marketplace tabs. */
.matrix-header-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.matrix-header-week {
  max-width: 138px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gray-dark, #333);
  font-size: 0.68rem;
  font-weight: 800;
}

.matrix-header-btn {
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: var(--gray-dark, #333);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 1px 2px -1px rgba(0, 0, 0, 0.08),
    0 2px 4px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  transition-property: transform, background-color, color, box-shadow;
  transition-duration: 140ms;
  transition-timing-function: ease-out;
}

.matrix-header-btn:hover,
.matrix-header-btn:focus-visible {
  color: var(--orange);
  background: var(--orange-soft);
  box-shadow:
    0 0 0 1px rgba(255, 81, 0, 0.35),
    0 2px 5px rgba(255, 81, 0, 0.12);
  outline: none;
}

.matrix-header-btn:active {
  transform: scale(0.96);
}

.matrix-header-btn[aria-pressed="true"] {
  color: #fff;
  background: var(--orange);
  box-shadow: 0 2px 7px rgba(255, 81, 0, 0.28);
}

.matrix-header-btn:disabled {
  color: #a3a8ad;
  background: #f4f5f6;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
  cursor: default;
  transform: none;
}

.matrix-heat-legend {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #6b737b;
  font-size: 0.61rem;
  font-weight: 700;
  white-space: nowrap;
}

.matrix-heat-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.matrix-heat-legend .is-down { background: rgba(235, 57, 57, 0.74); }
.matrix-heat-legend .is-flat { background: #eef1f4; }
.matrix-heat-legend .is-up { background: rgba(0, 176, 80, 0.72); }

/* Header date picker — compact single row */
.header-period {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  background: var(--white);
  border: 1px solid #e8e8e8;
  box-shadow: none;
  padding: 2px 6px;
}

.header-period-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 6px;
}

.header-period-compact {
  min-height: 30px;
}

.header-period-icon {
  display: none;
  line-height: 1;
  opacity: 0.85;
}

.header-period-range-pick {
  max-width: 130px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 6px;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: var(--gray);
  cursor: pointer;
  flex: 0 0 auto;
}

.header-period-range-pick:focus {
  border-color: var(--orange);
  outline: none;
}

.header-period-static {
  font-size: 0.72rem;
  color: var(--gray);
}

.header-period-presets {
  display: none;
  flex-wrap: wrap;
  gap: 4px;
}

.header-period-shift {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-period-shift-btn {
  border: 1px solid #e0e0e0;
  background: #fff;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  width: 24px;
  height: 24px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.header-period-shift-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: var(--orange-soft);
}

.header-period-preset {
  border: 1px solid #e0e0e0;
  background: #fff;
  color: var(--gray);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.header-period-preset:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.header-period-preset.is-active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.header-period-dates {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
}

.header-period-date-lbl {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--gray);
}

.header-period-date-cap {
  opacity: 0.75;
}

.header-period-date-lbl input[type="date"] {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid #ddd;
  padding: 2px 4px;
  min-width: 0;
  width: 118px;
  max-width: 118px;
  color: var(--gray);
}

.header-period-apply {
  padding: 3px 8px !important;
  font-size: 0.68rem !important;
  min-height: 24px;
  line-height: 1.2;
}

.header-period-sep {
  color: #aaa;
  font-weight: 700;
}

.header-chart-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.header-chart-group-lbl {
  display: none;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gray);
  white-space: nowrap;
}

.header-chart-group-select {
  border: 1px solid #e0e0e0;
  background: #fff;
  color: var(--gray-dark, #333);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 6px;
  cursor: pointer;
  min-width: 96px;
  max-width: 110px;
}

.header-chart-group-select:hover,
.header-chart-group-select:focus {
  border-color: var(--orange);
  outline: none;
}

.header-period-summary {
  display: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--orange-dark);
  white-space: nowrap;
}

.site-header h1 {
  flex: 0 1 auto;
  min-width: 0;
}

@media (max-width: 1200px) {
  .site-header-inner {
    flex-wrap: nowrap;
    row-gap: 0;
  }

  .header-mp-scope {
    order: initial;
    flex: 0 1 auto;
  }

  .header-period {
    order: initial;
    flex: 1 1 auto;
  }

  .header-actions {
    order: initial;
  }

  .matrix-heat-legend {
    display: none;
  }
}

@media (max-width: 900px) {
  .matrix-header-week {
    display: none;
  }

  .matrix-header-btn {
    padding-inline: 8px;
  }

  .header-mp-scope .global-mp-chips {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
    padding-bottom: 2px;
  }

  .header-mp-scope .global-mp-chips::-webkit-scrollbar {
    display: none;
  }

  .header-period-inner {
    flex-wrap: wrap;
  }

  .header-period-date-lbl input[type="date"] {
    width: 108px;
    max-width: 108px;
  }
}

@media (max-width: 1100px) {
  .site-header h1 {
    display: none;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 4px 0;
    overflow-x: visible;
  }

  .site-header-inner {
    padding: 0 8px;
    gap: 6px;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .site-header img {
    height: 22px;
  }

  .header-mp-scope .global-mp-chip {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  .header-actions .np-badge {
    display: none;
  }

  .header-period-range-pick {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .header-period {
    order: 3;
    flex-basis: 100%;
  }

  .header-period-inner,
  .header-period-dates {
    flex-wrap: wrap;
  }

  .header-chart-group-lbl {
    display: none;
  }
}

.header-actions.toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
}

.np-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(255, 81, 0, 0.2);
  letter-spacing: 0.02em;
}

/* Compact dashboard (actions) */
.dashboard-compact .stats-grid {
  margin-bottom: 8px;
  gap: 8px;
}

.dashboard-compact .stat-card {
  padding: 10px 12px;
}

.dashboard-compact .stat-value {
  font-size: 1.25rem;
}

.dashboard-compact .block-panel {
  margin-bottom: 8px;
  padding: 10px 12px;
}

.dashboard-compact .block-panel h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.dashboard-compact .site-footer {
  display: none;
}

/* Panels & KPI */
.block-panel {
  background: var(--white);
  border: 1px solid #eee;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
  margin-bottom: 28px;
}

.block-panel h3 {
  margin: 0 0 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--orange);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-hero-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.stat-card.kpi-hero {
  text-align: left;
  padding: 20px 18px 16px;
  position: relative;
  overflow: hidden;
}

.kpi-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
  min-height: 28px;
}

.kpi-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.kpi-trend {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.kpi-trend.kpi-up {
  color: #1a7a3a;
  background: rgba(42, 157, 82, 0.12);
}

.kpi-trend.kpi-down {
  color: #b91c1c;
  background: rgba(212, 43, 43, 0.1);
}

.stat-value.kpi-val-good,
.focus-hero-kpi .val.kpi-val-good {
  color: #1a7a3a !important;
}

.stat-value.kpi-val-bad,
.focus-hero-kpi .val.kpi-val-bad {
  color: #b91c1c !important;
}

.focus-kpi-head {
  min-height: 24px;
  margin-bottom: 6px;
}

.focus-kpi-unit {
  font-size: 18px;
  font-weight: 700;
}

#mpTabBar,
.mp-tab-bar,
.focus-mp-tabs {
  display: none !important;
}

.focus-mp-tab {
  border: 1px solid var(--border, #e0e0e0);
  background: #fafafa;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.focus-mp-tab:hover {
  border-color: var(--orange, #ff5100);
  color: var(--orange, #ff5100);
}

.focus-mp-tab.active {
  background: var(--orange, #ff5100);
  border-color: var(--orange, #ff5100);
  color: #fff;
}

.focus-mp-hint {
  margin: 0;
  font-size: 0.9rem;
}

.mp-tab-bar {
  display: none !important;
}

.mp-tab-bar .mp-tab {
  border: 1px solid var(--border, #e0e0e0);
  background: #fafafa;
  padding: 8px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
}

.mp-tab-bar .mp-tab.active {
  background: var(--orange, #ff5100);
  border-color: var(--orange, #ff5100);
  color: #fff;
}

.manager-mp-scope {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
  padding: 4px 10px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e8e8e8);
}

.manager-mp-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-mid, #666);
  white-space: nowrap;
}

.manager-mp-select {
  font: inherit;
  font-weight: 700;
  padding: 6px 10px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 6px;
  background: #fafafa;
  cursor: pointer;
}

.global-mp-scope {
  margin-bottom: 12px;
  padding: 10px 14px;
}

/* Legacy body placement — kept for backwards compat if re-mounted elsewhere */
.global-mp-scope.block-panel {
  margin-bottom: 12px;
  padding: 10px 14px;
}

.global-mp-scope-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.global-mp-scope-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-mid, #666);
  white-space: nowrap;
}

.global-mp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.global-mp-chip {
  border: 1px solid var(--border, #e0e0e0);
  background: #fafafa;
  padding: 8px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.global-mp-chip:hover {
  border-color: var(--orange, #ff5100);
  color: var(--orange, #ff5100);
}

.global-mp-chip.active {
  background: var(--orange, #ff5100);
  border-color: var(--orange, #ff5100);
  color: #fff;
}

.only-wb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.only-wb-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--orange, #ff5100);
  cursor: pointer;
}

#nav a.nav-mp-muted {
  opacity: 0.42;
  pointer-events: auto;
}

#nav a.nav-mp-muted:hover {
  opacity: 0.65;
}

.kpi-hint {
  font-size: 0.78rem;
  color: var(--gray-mid, #666);
  margin-top: 8px;
  line-height: 1.35;
  font-weight: 500;
}

.kpi-spark-wrap {
  height: 44px;
  margin-top: 10px;
}

.kpi-hero.money .stat-value {
  color: var(--orange);
}

.kpi-hero.bad,
.kpi-hero.critical {
  border-color: rgba(212, 43, 43, 0.35);
  background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
}

.stat-card {
  background: var(--white);
  border: 1px solid #eee;
  box-shadow: var(--shadow);
  padding: 18px 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--orange);
  line-height: 1.2;
  min-height: 1.2em;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--gray-mid);
  margin-top: 4px;
  font-weight: 600;
  min-height: 2.4em;
  line-height: 1.25;
}

/* Buttons (actions) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--orange);
  color: #fff;
}

.btn-primary:hover {
  background: var(--orange-dark);
}

.btn-secondary {
  background: var(--gray);
  color: #fff;
}

.btn-outline {
  background: var(--white);
  color: var(--gray);
  border: 1px solid #ddd;
}

.btn-outline:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Form controls (actions filters) */
.filter-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 6px;
}

.filter-group input,
.filter-group select,
.input-patriot {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-group input:focus,
.filter-group select:focus,
.input-patriot:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(255, 81, 0, 0.15);
}

.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.8rem;
  color: var(--gray-light);
  border-top: 1px solid #eee;
}

.site-footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 8px;
}

.site-footer-link {
  color: var(--orange-dark);
  font-weight: 800;
  text-decoration: none;
}

.site-footer-link:hover {
  color: var(--orange);
  text-decoration: underline;
}

.site-footer-link-muted {
  font-weight: 700;
  color: var(--gray-mid);
}

.site-footer-copy {
  color: var(--gray-light);
}

@media (max-width: 640px) {
  .site-header h1 {
    font-size: 0.9rem;
  }

  .block-panel {
    padding: 20px 16px;
  }

  .site-footer {
    padding: 20px 16px;
  }
}
