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

.history-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-controls-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.history-controls-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.history-control-field {
  min-width: 0;
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-control-field span {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.history-control-field select,
.history-control-field input,
.history-control-static {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: #fff;
  color: #0f172a;
  padding: 0 12px;
  font-size: 14px;
}

.history-control-field input {
  width: 100%;
}

.history-control-static {
  display: inline-flex;
  align-items: center;
}

.history-control-field--disabled {
  opacity: 0.82;
}

.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.history-summary-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.86);
}

.history-summary-card span {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.history-summary-card strong {
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  color: #0f172a;
}

.history-task-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.history-task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.history-task-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
}

.history-task-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.history-task-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.history-task-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-task-meta-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.history-task-meta-value {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

.history-empty-state {
  padding: 16px;
  border-radius: 16px;
}

.history-card {
  padding: 14px;
}

.history-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.history-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.history-card-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

.history-amount {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.history-status-line,
.history-message-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.history-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.history-status--paid {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

.history-status--unpaid {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.history-status--unknown {
  background: rgba(148, 163, 184, 0.14);
  color: #475569;
}

.history-status-arrow {
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  align-self: center;
}

.history-card-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.history-toggle-sign {
  font-size: 22px;
  line-height: 1;
  color: #2563eb;
  flex: 0 0 auto;
}

.history-message-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.history-detail-block {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: #f8fafc;
  padding: 12px;
}

.history-detail-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.history-company-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-company-result {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.history-company-result.success {
  color: #166534;
}

.history-company-result.error {
  color: #b91c1c;
}

.history-company-error {
  color: #64748b;
  text-align: right;
}

.history-message-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #0f172a;
}

@media (max-width: 1200px) {
  .history-card-head,
  .history-company-result {
    flex-direction: column;
  }

  .history-amount,
  .history-company-error {
    white-space: normal;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .history-summary-grid,
  .history-task-meta-grid {
    grid-template-columns: 1fr;
  }

  .history-task-head {
    flex-direction: column;
    align-items: stretch;
  }
}
