/* Compact responsive planning grid. Loaded after styles.css on purpose. */
#commoditiesToolbar .operating-planning-toolbar-v2 {
  display: grid;
  gap: 9px;
  width: 100%;
}

#commoditiesToolbar .operating-planning-toolbar-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

#commoditiesToolbar .operating-planning-period-nav {
  display: inline-grid;
  grid-template-columns: 38px 88px 38px;
  flex: 0 0 auto;
  width: 164px;
  overflow: hidden;
  height: 34px;
  border: 1px solid #d3e1df;
  border-radius: 6px;
  background: #f6faf9;
}

#commoditiesToolbar .operating-planning-period-nav button {
  display: grid;
  place-items: center;
  width: 100%;
  height: 32px;
  padding: 0;
  border: 0;
  border-right: 1px solid #d3e1df;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

#commoditiesToolbar .operating-planning-period-nav .operating-planning-today {
  font-size: 12px;
  font-weight: 600;
}

#commoditiesToolbar .operating-planning-period-nav button:last-child {
  border-right: 0;
}

#commoditiesToolbar .operating-planning-period-nav button:hover,
#commoditiesToolbar .operating-planning-period-nav button:focus-visible {
  background: #dff2ee;
  color: var(--brand-accent);
}

#commoditiesToolbar .operating-planning-department {
  width: clamp(150px, 18vw, 230px);
  height: 34px;
  padding: 0 30px 0 9px;
  border: 1px solid #d3e1df;
  border-radius: 6px;
  background-color: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.commodity-form-field[hidden] {
  display: none;
}

#commoditiesToolbar .operating-planning-toolbar-controls > label:not(.operating-planning-archive-toggle) {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

#commoditiesToolbar .operating-planning-toolbar-controls input:is([type="month"], [type="date"]) {
  box-sizing: border-box;
  width: 148px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #d3e1df;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

#commoditiesToolbar :is(.operating-planning-axis, .operating-planning-scale) {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 2px;
  border: 1px solid #d3e1df;
  border-radius: 6px;
  background: #f6faf9;
}

#commoditiesToolbar :is(.operating-planning-axis, .operating-planning-scale) button {
  min-width: 66px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

#commoditiesToolbar :is(.operating-planning-axis, .operating-planning-scale) button.is-active {
  background: #dff2ee;
  color: var(--text);
  font-weight: 700;
}

#commoditiesToolbar .operating-planning-archive-toggle {
  min-height: 34px;
  margin-left: auto;
}

#commoditiesToolbar .operating-planning-workforce {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

#commoditiesToolbar .operating-planning-workforce > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  min-height: 31px;
  padding: 6px 12px;
  border-right: 1px solid var(--line);
  color: var(--muted);
}

#commoditiesToolbar .operating-planning-workforce > span:last-child {
  border-right: 0;
}

#commoditiesToolbar .operating-planning-workforce small {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#commoditiesToolbar .operating-planning-workforce strong {
  color: var(--text);
  font-size: 13px;
}

#commoditiesToolbar .operating-planning-workforce .is-administration :is(small, strong) {
  color: #16835f;
}

#commoditiesToolbar .operating-planning-workforce .is-total strong {
  color: var(--brand-accent);
}

#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale] {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: min(720px, calc(100dvh - 140px));
  height: calc(100dvh - 140px);
  overflow: auto;
  border-color: #d5e4e1 !important;
  border-radius: 6px !important;
  background: #fff !important;
  scrollbar-gutter: stable;
}

#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale] > table.operating-planning-calendar-v2 {
  width: max(100%, var(--planning-table-width)) !important;
  min-width: var(--planning-table-width) !important;
  max-width: none !important;
  height: max-content !important;
  min-height: 0 !important;
  max-height: max-content !important;
  table-layout: fixed !important;
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 col.operating-planning-employee-column {
  width: 170px !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2[data-axis="objects"] col.operating-planning-employee-column {
  width: 210px !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 col.operating-planning-period-column {
  width: var(--planning-period-width) !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 :is(thead, tbody, tfoot) tr > :first-child {
  position: sticky !important;
  left: 0 !important;
  z-index: 4 !important;
  width: 170px !important;
  min-width: 170px !important;
  max-width: 170px !important;
  background: #fbfdfc !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2[data-axis="objects"] :is(thead, tbody, tfoot) tr > :first-child {
  width: 210px !important;
  min-width: 210px !important;
  max-width: 210px !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 thead .operating-planning-period-row th {
  position: sticky !important;
  top: 0 !important;
  z-index: 6 !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 3px 4px !important;
  border-right: 1px solid #d9e6e4 !important;
  border-bottom: 1px solid #cbdedb !important;
  background: #f4f8f7 !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 1.05 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 thead .operating-planning-period-row th:first-child {
  z-index: 9 !important;
  padding-left: 10px !important;
  text-align: left !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 thead .operating-planning-period-row th > span {
  display: block !important;
  margin: 0 !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 15px !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 thead .operating-planning-period-row th > small {
  display: block !important;
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  line-height: 12px !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tbody tr,
#commoditiesWorkspace .operating-planning-calendar-v2 tbody tr > :is(th, td) {
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tbody tr > :is(th, td),
#commoditiesWorkspace .operating-planning-calendar-v2 tfoot tr > :is(th, td) {
  box-sizing: border-box;
  padding: 0 !important;
  border-right: 1px solid #e0ebe9 !important;
  border-bottom: 1px solid #e0ebe9 !important;
  background: #fff !important;
  line-height: 1.1 !important;
  vertical-align: middle !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tbody tr > th,
#commoditiesWorkspace .operating-planning-calendar-v2 tfoot tr > th {
  padding: 3px 8px 3px 10px !important;
  overflow: hidden !important;
  text-align: left;
}

#commoditiesWorkspace .operating-planning-calendar-v2 :is(thead, tbody, tfoot) tr > :last-child {
  border-right: 0 !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 .operating-planning-person-cell {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
  height: 30px !important;
  overflow: hidden !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 .operating-planning-person-dot {
  flex: 0 0 auto !important;
  width: 8px !important;
  height: 8px !important;
  margin: 0 7px 0 0 !important;
  background: var(--personnel-color, #e5b91f) !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 .operating-planning-person {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tbody tr > th strong {
  display: block !important;
  max-width: 100% !important;
  overflow: hidden !important;
  color: #182b28 !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 17px !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#commoditiesWorkspace .operating-planning-object-name small {
  display: block !important;
  margin-top: 1px !important;
  overflow: hidden;
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  line-height: 12px !important;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tbody :is(.operating-planning-project, .operating-planning-absence, .operating-planning-empty-cell) {
  box-sizing: border-box !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  margin: 0 !important;
  padding: 0 3px !important;
  line-height: 30px !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
}

#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale="weeks"] .operating-planning-calendar-v2 tbody tr > :not(:first-child),
#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale="weeks"] .operating-planning-calendar-v2 thead .operating-planning-period-row > th:not(:first-child),
#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale="weeks"] .operating-planning-calendar-v2 tfoot tr > :not(:first-child) {
  width: auto !important;
  min-width: 78px !important;
  max-width: none !important;
}

#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale="days"] .operating-planning-calendar-v2 tbody tr > :not(:first-child),
#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale="days"] .operating-planning-calendar-v2 thead .operating-planning-period-row > th:not(:first-child),
#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale="days"] .operating-planning-calendar-v2 tfoot tr > :not(:first-child) {
  width: auto !important;
  min-width: 42px !important;
  max-width: none !important;
}

#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale="months"] .operating-planning-calendar-v2 tbody tr > :not(:first-child),
#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale="months"] .operating-planning-calendar-v2 thead .operating-planning-period-row > th:not(:first-child),
#commoditiesWorkspace .operating-planning-calendar-wrap[data-scale="months"] .operating-planning-calendar-v2 tfoot tr > :not(:first-child) {
  width: auto !important;
  min-width: 110px !important;
  max-width: none !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 :is(th, td).is-month-start {
  border-left: 1px solid #4aa99b !important;
}

#commoditiesWorkspace .operating-planning-object-name {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-weight: 400;
  letter-spacing: 0;
}

#commoditiesWorkspace .operating-planning-object-name > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--project-color, #83afd9);
}

#commoditiesWorkspace .operating-planning-object-name > span {
  min-width: 0;
  overflow: hidden;
}

#commoditiesWorkspace .operating-planning-objects-table tbody tr,
#commoditiesWorkspace .operating-planning-objects-table tbody tr > :is(th, td) {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
}

#commoditiesWorkspace .operating-planning-plan-fact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  min-width: 0;
  padding: 2px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

#commoditiesWorkspace .operating-planning-plan-fact-values {
  display: inline-flex !important;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  min-width: 0;
}

#commoditiesWorkspace .operating-planning-plan-fact-values i {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  line-height: 12px;
}

#commoditiesWorkspace .operating-planning-plan-fact strong {
  color: #263d39;
  font-size: 12px;
  font-weight: 400;
  line-height: 14px;
}

#commoditiesWorkspace .operating-planning-plan-fact em {
  min-width: 17px;
  padding: 2px;
  border-radius: 3px;
  background: #edf2f1;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
}

#commoditiesWorkspace .operating-planning-plan-fact.is-deficit em {
  background: #fff0e5;
  color: #a94c19;
}

#commoditiesWorkspace .operating-planning-plan-fact.is-surplus em {
  background: #e8f5ef;
  color: #147653;
}

#commoditiesWorkspace .operating-planning-calendar-v2 td.is-outside-project {
  background: #f7f9f8 !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tfoot tr > :is(th, td) {
  position: sticky;
  bottom: 0;
  z-index: 7;
  height: 44px !important;
  min-height: 44px !important;
  background: #eef7f5 !important;
  border-top: 1px solid #bdd8d2 !important;
  border-bottom: 0 !important;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tfoot tr > th {
  z-index: 8;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tfoot th > :is(strong, small) {
  display: block;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tfoot th strong {
  color: #183c36;
  font-size: 11px;
}

#commoditiesWorkspace .operating-planning-calendar-v2 tfoot th small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.operating-planning-object-picker {
  width: 230px;
}

.operating-planning-object-picker button > span {
  display: grid;
  min-width: 0;
}

.operating-planning-object-picker button > span :is(strong, small) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operating-planning-object-picker button > span strong {
  font-size: 11px;
}

.operating-planning-object-picker button > span small {
  color: var(--muted);
  font-size: 9px;
}

.operating-planning-object-picker-status {
  display: block;
  min-height: 0;
  padding: 4px 5px 0;
  color: #a5453f;
  font-size: 11px;
}

.operating-planning-object-picker-status:empty {
  display: none;
}

.accounting-client-checkbox {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  color: var(--text) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

.accounting-client-checkbox input {
  width: 17px !important;
  min-height: 17px !important;
}

.accounting-clients-table th:nth-child(1) { width: 22%; }
.accounting-clients-table th:nth-child(2) { width: 23%; }
.accounting-clients-table th:nth-child(3) { width: 20%; }
.accounting-clients-table th:nth-child(4) { width: 18%; }
.accounting-clients-table th:nth-child(5) { width: 8%; }
.accounting-clients-table th:nth-child(6) { width: 9%; }

@media (max-width: 1100px) {
  #commoditiesToolbar .operating-planning-toolbar-controls {
    flex-wrap: wrap;
  }

  #commoditiesToolbar .operating-planning-archive-toggle {
    margin-left: 0;
  }

  #commoditiesWorkspace .operating-planning-calendar-wrap[data-scale] {
    min-height: min(620px, calc(100dvh - 180px));
    height: calc(100dvh - 180px);
  }
}

@media (max-width: 720px) {
  #commoditiesToolbar .operating-planning-toolbar-v2 {
    display: grid;
    padding: 0 10px;
  }

  #commoditiesToolbar .operating-planning-toolbar-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px;
  }

  #commoditiesToolbar .operating-planning-period-nav {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    width: 100%;
  }

  #commoditiesToolbar .operating-planning-toolbar-controls > label:not(.operating-planning-archive-toggle),
  #commoditiesToolbar .operating-planning-toolbar-controls input:is([type="month"], [type="date"]) {
    width: 100%;
  }

  #commoditiesToolbar :is(.operating-planning-axis, .operating-planning-scale) {
    width: 100%;
  }

  #commoditiesToolbar .operating-planning-department {
    width: 100%;
  }

  #commoditiesToolbar :is(.operating-planning-axis, .operating-planning-scale) button {
    flex: 1 1 0;
    min-width: 0;
  }

  #commoditiesToolbar .operating-planning-scale,
  #commoditiesToolbar .operating-planning-archive-toggle {
    grid-column: 1 / -1;
  }

  #commoditiesToolbar .operating-planning-workforce {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #commoditiesToolbar .operating-planning-workforce > span:nth-child(2) {
    border-right: 0;
  }

  #commoditiesToolbar .operating-planning-workforce > span:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}
