.gruz-planer {
  background: #f7f7f8;
  border: 1px solid #d9dde6;
  border-radius: 18px;
  padding: 18px;
  overflow: hidden;
}

.gruz-planer__header {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gruz-planer__controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}


.gruz-planer__eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #5f6b7c;
  margin-bottom: 8px;
}

.gruz-planer h2 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.15;
  color: #112042;
}

.gruz-planer__message {
  color: #4f5868;
  font-size: 16px;
  line-height: 1.5;
}

.gruz-planer__toolbar,
.gruz-planer__meta-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.gruz-planer__meta-controls {
  margin-top: 14px;
}

.gruz-planer__hidden-meta {
  display: none !important;
}


.gruz-planer__toolbar--templates {
  margin-top: 0;
  padding-top: 0;
}

.gruz-planer__toolbar--templates .gruz-planer__field--wide {
  min-width: 190px;
}

.gruz-planer__toolbar--templates .gruz-planer__templates-name {
  min-width: 220px;
  flex: 1 1 220px;
}

.gruz-planer__toolbar--templates .gruz-planer__templates-select {
  min-width: 180px;
  flex: 1 1 180px;
}

.gruz-planer__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 110px;
}

.gruz-planer__field--small { width: 90px; }
.gruz-planer__field--wide { min-width: 210px; }

.gruz-planer__field > span {
  font-size: 12px;
  color: #4e5562;
  font-weight: 600;
}

.gruz-planer__field select,
.gruz-planer__field input {
  height: 44px;
  border-radius: 12px;
  border: 1px solid #cfd5df;
  background: #fff;
  padding: 0 14px;
  font-size: 18px;
  color: #1d2532;
  width: 100%;
  box-sizing: border-box;
}

.gruz-planer__field input[readonly] {
  background: #f1f3f8;
}

.gruz-planer__reset {
  height: 44px;
  border: 1px solid #cfd5df;
  background: #fff;
  color: #18223a;
  border-radius: 12px;
  padding: 0 18px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.gruz-planer__reset:hover,
.gruz-planer__reserve-chip:hover {
  transform: translateY(-1px);
}

.gruz-planer__reset.is-disabled,
.gruz-planer__reset:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
}

.gruz-planer__reserve-box {
  min-width: 320px;
}

.gruz-planer__reserve-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.gruz-planer__reserve-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gruz-planer__reserve-inline > input {
  width: 160px;
  max-width: 100%;
}


.gruz-planer__reserve-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gruz-planer__reserve-chip {
  height: 44px;
  min-width: 70px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #b7c4da;
  background: #edf2fb;
  color: #17305d;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.gruz-planer__reserve-chip.is-active {
  background: #1da14b;
  border-color: #1a9344;
  color: #fff;
  box-shadow: 0 8px 18px rgba(29, 161, 75, .18);
}

.gruz-planer__note {
  display: none !important;
}

.gruz-planer__round-wrap {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gruz-planer__round-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gruz-planer__matrix-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.gruz-planer__matrix {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #e5e5e5;
}

.gruz-planer__matrix th,
.gruz-planer__matrix td {
  border: 1px solid #272727;
  text-align: center;
  vertical-align: middle;
}

.gruz-planer__matrix-head-empty {
  width: 175px;
  background: transparent;
  border: none !important;
}

.gruz-planer__matrix-picked-head,
.gruz-planer__matrix-picked-top,
.gruz-planer__matrix-picked-bottom {
  width: 76px;
  min-width: 76px;
  background: transparent;
  border: none !important;
}

.gruz-planer__matrix-picked {
  width: 76px;
  min-width: 76px;
  border: none !important;
  background: transparent;
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  padding: 0 4px;
  text-align: center;
  letter-spacing: 0;
}

.gruz-planer__matrix-head-label {
  height: 66px;
  font-size: 22px;
  font-weight: 500;
  background: #f8f8f8;
}

.gruz-planer__matrix-total {
  background: #f7f7f7;
  width: 175px;
  min-width: 175px;
}

.gruz-planer__matrix-total-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.gruz-planer__matrix-total strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.gruz-planer__matrix-total small {
  display: block;
  margin-top: 4px;
  color: #444;
  font-size: 13px;
}

.gruz-planer__matrix-head-weight {
  background: #fff200;
  padding: 0;
}

.gruz-planer__matrix-head-weight input {
  width: 100%;
  height: 72px;
  border: none;
  background: #fff200;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  padding: 0 8px;
  box-sizing: border-box;
}

.gruz-planer__matrix-step {
  width: 80px;
  background: transparent;
  border-left: none !important;
  border-top: none !important;
  border-bottom: none !important;
  font-size: 20px;
  font-style: italic;
  font-weight: 600;
  color: #1b7943;
  cursor: grab;
  user-select: none;
  padding-right: 8px;
}

.gruz-planer__matrix-step-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.gruz-planer__matrix-step-handle {
  font-size: 14px;
  line-height: 1;
  color: #7a8597;
  letter-spacing: -1px;
}

.gruz-planer__matrix-step-row.is-dragging {
  opacity: .65;
}

.gruz-planer__matrix-step-row.is-drop-target .gruz-planer__matrix-step {
  color: #0f5ec5;
}

.gruz-planer__matrix-cell {
  position: relative;
  height: 72px;
  background: #f7f7f7;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.gruz-planer__matrix-cell--x::before,
.gruz-planer__matrix-cell--x::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 42px;
  height: 2px;
  background: #8f97a3;
  transform: translateX(-50%);
  border-radius: 999px;
}

.gruz-planer__matrix-cell--x::before {
  top: calc(50% - 8px);
}

.gruz-planer__matrix-cell--x::after {
  top: calc(50% + 8px);
}

.gruz-planer__matrix-idle-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6c7786;
  transform: translate(-50%, -50%);
}

.gruz-planer__matrix-cell--pending {
  background: #f0e8b2;
}

.gruz-planer__matrix-cell--filled {
  background: #cad7e6;
}

.gruz-planer__matrix-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #30456f;
}

.gruz-planer__matrix-bottom--empty {
  border-left: none !important;
  border-bottom: none !important;
  border-top: none !important;
  background: transparent;
  padding-right: 10px;
  text-align: left !important;
  padding-right: 14px;
}

.gruz-planer__matrix-bottom-total-label {
  display: block;
  font-size: 13px;
  font-style: italic;
  color: #555;
  margin-bottom: 4px;
}

.gruz-planer__matrix-bottom--empty strong {
  font-size: 22px;
  line-height: 1;
  color: #111;
}

.gruz-planer__matrix-bottom {
  height: 56px;
  font-size: 18px;
  font-weight: 700;
}

.gruz-planer__matrix-bottom--warn {
  background: #d54b4b;
  color: #fff;
}

.gruz-planer__matrix-bottom--ok {
  background: #12a83d;
  color: #fff;
}

.gruz-planer__matrix-bottom--left {
  background: #ececec;
  color: #223;
}

.gruz-planer__check {
  margin-top: 18px;
  display: none !important;
}

.gruz-planer__check-card {
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 14px;
  padding: 14px;
}

.gruz-planer__check-title {
  font-size: 18px;
  font-weight: 700;
  color: #14213d;
  margin-bottom: 10px;
}

.gruz-planer__check-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.gruz-planer__check-table th,
.gruz-planer__check-table td {
  border: 1px solid #d8dee8;
  padding: 8px 10px;
  text-align: center;
}

.gruz-planer__check-table thead th {
  background: #f3f6fb;
}

.gruz-planer__check-table .is-ok {
  color: #11803e;
  font-weight: 700;
}

.gruz-planer__check-table .is-warn {
  color: #9b1d1d;
  font-weight: 700;
}

.gruz-planer__message {
  margin-top: 14px;
  background: #f2f6fb;
  border: 1px solid #d5dfea;
  border-radius: 12px;
  padding: 12px 14px;
  color: #2c3d52;
}

.gruz-planer__message.is-error {
  background: #ffe9e9;
  border-color: #f1b7b7;
  color: #8c2f36;
}

@media (max-width: 980px) {
  .gruz-planer__header {
    grid-template-columns: 1fr;
  }

  .gruz-planer__toolbar,
  .gruz-planer__meta-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gruz-planer__field--wide,
  .gruz-planer__reserve-box {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .gruz-planer {
    padding: 14px;
  }

  .gruz-planer h2 {
    font-size: 22px;
  }

  .gruz-planer__toolbar,
  .gruz-planer__meta-controls {
    grid-template-columns: 1fr;
  }

  .gruz-planer__matrix {
    min-width: 900px;
  }

  .gruz-planer__round-wrap {
    flex-direction: column;
    align-items: stretch;
  }
}


.gruz-planer__matrix-cell--manual {
  padding: 6px;
  background: #eef4fb;
}

.gruz-planer__cell-input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #9fb4d3;
  background: #fff;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  box-sizing: border-box;
  padding: 0 8px;
}

.gruz-planer__matrix-cell--clamped {
  background: #f7e7d4;
}

.gruz-planer__cell-badge {
  margin-top: 4px;
  font-size: 11px;
  color: #7b4a12;
  line-height: 1.2;
}

.gruz-planer__check-meta {
  margin-top: 10px;
  font-size: 13px;
  color: #526071;
}


.gruz-planer__field input.is-readonly {
  background: #eef2f7;
  color: #5f6b7c;
  cursor: not-allowed;
}

.gruz-planer__matrix-head-weight input.is-manual-total {
  box-shadow: inset 0 0 0 2px rgba(17, 32, 66, .14);
  background: #ffef8a;
}

.gruz-planer__undo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.gruz-planer__undo-icon {
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 900px) {
  .gruz-planer__toolbar--templates .gruz-planer__templates-name,
  .gruz-planer__toolbar--templates .gruz-planer__templates-select {
    min-width: 100%;
    flex-basis: 100%;
  }
}

.gruz-planer__matrix-step-handle { cursor: grab; user-select: none; }
.gruz-planer__matrix-step-handle:active { cursor: grabbing; }


.gruz-planer__check--hidden { display:none !important; }

.gruz-planer__message { margin-top:10px; font-size:14px; }

.gruz-planer__matrix-step, .gruz-planer__matrix-step-handle { cursor: grab; user-select: none; }
.gruz-planer__matrix-step:active, .gruz-planer__matrix-step-handle:active { cursor: grabbing; }


.gruz-planer__drag-help {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef5ff;
  border: 1px solid #cddcf7;
  color: #35507a;
  font-size: 14px;
  line-height: 1.45;
}

.gruz-planer__total-input {
  display: block;
  width: calc(100% - 20px);
  margin: 0 auto;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #c9cfda;
  background: #ffffff;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #0f1d38;
  padding: 0 10px;
  box-sizing: border-box;
}

.gruz-planer__total-input:focus {
  outline: none;
  border-color: #2d6df6;
  box-shadow: 0 0 0 3px rgba(45, 109, 246, .16);
}

.gruz-planer__matrix-step-row {
  position: relative;
}

.gruz-planer__matrix-step-inner {
  padding: 6px 12px;
  border-radius: 999px;
  background: #f2f8f2;
  border: 1px dashed #bfd3c1;
}

.gruz-planer__matrix-step-handle {
  padding: 3px 5px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d5deea;
}

.gruz-planer__matrix-step-row.is-dragging td {
  background-image: linear-gradient(0deg, rgba(45,109,246,.10), rgba(45,109,246,.10));
  box-shadow: inset 0 4px 0 #2d6df6, inset 0 -4px 0 #2d6df6;
}

.gruz-planer__matrix-step-row.is-dragging td:first-child {
  box-shadow: inset 4px 0 0 #2d6df6, inset 0 4px 0 #2d6df6, inset 0 -4px 0 #2d6df6;
}

.gruz-planer__matrix-step-row.is-dragging td:last-child {
  box-shadow: inset -4px 0 0 #2d6df6, inset 0 4px 0 #2d6df6, inset 0 -4px 0 #2d6df6;
}

.gruz-planer__matrix-step-row.is-dragging .gruz-planer__matrix-step {
  color: #0f5ec5;
}

.gruz-planer__matrix-step-row.is-dragging .gruz-planer__matrix-step-inner {
  background: #edf4ff;
  border-color: #8db0f0;
}

.gruz-planer__matrix-step-row.is-drop-target td {
  background-image: linear-gradient(0deg, rgba(31,111,255,.08), rgba(31,111,255,.08));
}

.gruz-planer__matrix-step-row.is-drop-before td {
  box-shadow: inset 0 5px 0 #1f6fff;
}

.gruz-planer__matrix-step-row.is-drop-after td {
  box-shadow: inset 0 -5px 0 #1f6fff;
}

.gruz-planer__matrix-step-row.is-drop-before td:first-child,
.gruz-planer__matrix-step-row.is-drop-after td:first-child,
.gruz-planer__matrix-step-row.is-drop-before td:last-child,
.gruz-planer__matrix-step-row.is-drop-after td:last-child {
  position: relative;
}

.gruz-planer__matrix-step-row.is-drop-before td:first-child::before,
.gruz-planer__matrix-step-row.is-drop-after td:first-child::before {
  content: '';
  position: absolute;
  left: -16px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 14px solid #1f6fff;
  z-index: 4;
}

.gruz-planer__matrix-step-row.is-drop-before td:first-child::before {
  top: -7px;
}

.gruz-planer__matrix-step-row.is-drop-after td:first-child::before {
  bottom: -7px;
}

.gruz-planer__matrix-step-row.is-drop-before td:last-child::after,
.gruz-planer__matrix-step-row.is-drop-after td:last-child::after {
  content: '';
  position: absolute;
  right: -10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1f6fff;
  z-index: 4;
}

.gruz-planer__matrix-step-row.is-drop-before td:last-child::after {
  top: -4px;
}

.gruz-planer__matrix-step-row.is-drop-after td:last-child::after {
  bottom: -4px;
}


body.gruz-planer--dragging,
body.gruz-planer--dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

.gruz-planer__matrix-step,
.gruz-planer__matrix-step-handle {
  touch-action: none;
}


.gruz-planer--dragging { user-select: none; }
.gruz-planer__matrix-step-row--drag-ghost {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  opacity: .96;
  box-shadow: 0 18px 42px rgba(17, 32, 66, .24);
}
.gruz-planer__matrix-step-row--drag-ghost > td,
.gruz-planer__matrix-step-row--drag-ghost > th {
  background: #ffffff !important;
}
.gruz-planer__matrix-step-row.is-dragging > td,
.gruz-planer__matrix-step-row.is-dragging > th {
  opacity: .32;
}
.gruz-planer__matrix-step-row.is-drop-target > td,
.gruz-planer__matrix-step-row.is-drop-target > th {
  background: #eef5ff !important;
}
.gruz-planer__matrix-step-row.is-drop-before {
  box-shadow: inset 0 4px 0 #1f6fff;
}
.gruz-planer__matrix-step-row.is-drop-after {
  box-shadow: inset 0 -4px 0 #1f6fff;
}
