.node-calculator-page {
  min-height: calc(100vh - 120px);
}

.node-calculator-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.node-calculator-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: var(--bs-body-bg);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.node-series-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.node-series-tab {
  position: relative;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 118px;
  min-height: 38px;
  padding: 7px 28px 7px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  color: #1f2937;
  background: #fff;
  font-weight: 650;
  box-shadow: none;
}

.node-series-tab:hover {
  background: #f9fafb;
  border-color: var(--node-series-color, #94a3b8);
}

.node-series-tab.active {
  color: #111827;
  background: #fff;
  border-color: var(--node-series-color, #2563eb);
  border-width: 3px;
  font-weight: 750;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.series-status {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.series-status.paused {
  color: #374151;
  background: #e5e7eb;
}

.series-status.waiting {
  color: #fff;
  background: #16a34a;
}

.series-status.running {
  color: #713f12;
  background: #facc15;
}

.series-close {
  position: absolute;
  top: 3px;
  right: 6px;
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.node-series-tab:hover .series-close,
.series-close:focus {
  color: #dc2626;
  background: #fee2e2;
}

.node-calculator-table-wrap {
  overflow-x: auto;
}

.node-calculator-table {
  min-width: 1328px;
  margin-bottom: 0;
  vertical-align: middle;
}

.node-calculator-table th {
  white-space: nowrap;
  color: #334155;
  background: var(--bs-tertiary-bg);
}

.node-calculator-table tbody tr {
  border-left: 5px solid var(--node-series-color, #2563eb);
}

.node-calculator-table tbody tr.node-series-start td {
  border-top-width: 3px;
  border-top-color: var(--node-series-color, #2563eb);
}

.node-calculator-table tbody tr.node-series-start:not(:first-child) td {
  box-shadow: inset 0 8px 0 rgba(15, 23, 42, 0.03);
}

.node-calculator-table tbody tr.node-series-summary {
  border-left: 5px solid var(--node-series-color, #2563eb);
}

.node-calculator-table tbody tr.node-series-summary td {
  padding: 8px 10px;
  border-bottom: 3px solid var(--node-series-color, #2563eb);
  background: rgba(37, 99, 235, 0.04);
}

.node-series-summary-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--node-series-color, #2563eb) 32%, #dbeafe);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
}

.node-series-summary-box strong {
  color: var(--node-series-color, #2563eb);
  font-weight: 800;
}

.node-series-summary-box span {
  padding: 2px 7px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #f8fafc;
  white-space: nowrap;
}

.node-series-point {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: 0;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.node-series-factor {
  margin-left: auto;
}

.node-series-point .form-control {
  width: 76px;
  min-width: 76px;
}

.node-calculator-table td {
  min-width: 78px;
}

.node-calculator-table td:nth-child(n + 7):nth-child(-n + 14) {
  width: 82px;
  min-width: 82px;
}

.node-calculator-table .node-name-cell {
  min-width: 88px;
  width: 96px;
}

.node-calculator-table .node-time-cell {
  min-width: 78px;
  width: 86px;
}

.node-calculator-table .node-actions-cell {
  width: 126px;
  min-width: 126px;
  text-align: right;
}

.node-calculator-table .node-actions-cell .btn-group {
  justify-content: flex-end;
  width: 100%;
}

.node-calculator-table .node-actions-cell .btn {
  padding-right: 0.45rem;
  padding-left: 0.45rem;
  white-space: nowrap;
}

.node-calculator-table .node-change-cell {
  width: 420px;
  min-width: 420px;
}

.node-calculator-table th:nth-child(15),
.node-calculator-table td:nth-child(15) {
  width: 82px;
  min-width: 82px;
  max-width: 82px;
}

.node-calculator-table .form-control {
  min-width: 0;
  padding-right: 0.35rem;
  padding-left: 0.35rem;
}

.node-input-rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 6px;
  align-items: center;
}

.node-input-rule .form-check-input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.node-calculator-table td:nth-child(3),
.node-calculator-table td:nth-child(4),
.node-calculator-table td:nth-child(5),
.node-calculator-table td:nth-child(6) {
  width: 86px;
}

.node-calculator-output {
  display: block;
  min-height: 31px;
  width: 74px;
  padding: 0.25rem 0.5rem;
  margin-left: auto;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #0f172a;
  background: #f8fafc;
  line-height: 1.5;
  text-align: right;
}

.node-calculator-change {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 31px;
  padding: 0.25rem 0.5rem;
  color: #334155;
  background: #f8fafc;
  border-radius: 6px;
  line-height: 1.5;
  white-space: normal;
  font-size: 13px;
}

.node-change-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fff;
  white-space: nowrap;
}

.node-change-label {
  color: #475569;
  font-weight: 700;
}

.node-change-pill.is-down .node-change-state,
.node-change-pill.is-down .node-change-value {
  color: #16a34a;
  font-weight: 800;
}

.node-change-pill.is-up .node-change-state,
.node-change-pill.is-up .node-change-value {
  color: #dc2626;
  font-weight: 800;
}

.node-change-pill.is-flat .node-change-state {
  color: #64748b;
  font-weight: 800;
}

.node-calculator-section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #475569;
}

.node-calculator-empty {
  padding: 28px;
  color: var(--bs-secondary-color);
  text-align: center;
}

.node-auto-config {
  padding: 14px;
  margin-bottom: 14px;
}

.node-auto-config-head,
.node-auto-log-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.node-auto-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.node-auto-config-grid label span {
  display: block;
  margin-bottom: 4px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.node-auto-enabled {
  display: flex;
  gap: 10px;
  align-items: center;
}

.node-auto-enabled span {
  margin-bottom: 0 !important;
}

.node-auto-toggle-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.node-auto-config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.node-auto-countdown {
  padding: 0.375rem 0.65rem;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  color: #334155;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 700;
}

.node-spend-peel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.node-spend-peel .form-control {
  width: 112px;
  min-width: 112px;
}

.node-inline-help {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  color: #64748b;
  background: #fff;
  font-size: 12px;
  line-height: 18px;
}

.node-sheet-alias-combo {
  display: flex;
  gap: 6px;
  align-items: center;
}

.node-sheet-alias-selected {
  display: flex;
  flex: 1 1 220px;
  min-height: 38px;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: 5px;
  padding-bottom: 5px;
}

.node-sheet-alias-combo .form-select {
  max-width: 180px;
}

.node-sheet-alias-combo .btn {
  width: 38px;
  padding-right: 0;
  padding-left: 0;
  font-weight: 800;
}

.node-sheet-alias-chip {
  padding: 2px 7px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 12px;
  font-weight: 700;
}

.node-auto-status {
  display: inline-flex;
  min-width: 64px;
  justify-content: center;
  padding: 3px 7px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  color: #475569;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
}

.node-auto-log-card {
  margin-top: 14px;
  padding: 14px;
}

.node-auto-log-table {
  min-width: 1050px;
}

@media (max-width: 992px) {
  .node-auto-config-grid {
    grid-template-columns: 1fr;
  }
}

.node-auto-telegram-field {
  grid-column: 1 / -1;
}

.node-telegram-config-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) repeat(3, minmax(180px, 1fr)) repeat(2, minmax(120px, 0.6fr));
  gap: 8px;
  align-items: center;
}

.node-telegram-config-grid .form-check span {
  margin-bottom: 0 !important;
}

@media (max-width: 1200px) {
  .node-telegram-config-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

.node-calculator-table {
  min-width: 1460px;
}

.node-calculator-table td:has([data-auto-field="cost"]),
.node-calculator-table td:has([data-field="spend"]),
.node-calculator-table td:has([data-output="spend"]),
.node-calculator-table td:has([data-output="cost"]) {
  width: 150px;
  min-width: 150px;
  max-width: none;
}

.node-calculator-table [data-auto-field="cost"],
.node-calculator-table [data-field="spend"] {
  width: 110px;
  min-width: 110px;
  max-width: none;
}

.node-calculator-table [data-output="spend"],
.node-calculator-table [data-output="cost"] {
  width: auto;
  min-width: 110px;
  max-width: none;
}

.node-summary-badge,
.node-series-summary .badge,
.node-series-summary .summary-pill {
  max-width: none;
  white-space: nowrap;
}
