/* styles.css - clean light technical theme */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #d7dee5;
  --border-soft: #e4e7eb;
  --ink: #1f2933;
  --muted: #52606d;
  --faint: #9aa5b1;
  --accent: #1565c0;
  --accent-hover: #1976d2;
  --accent-press: #0d47a1;
  --danger: #c62828;
  --danger-hover: #d32f2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

.app-header {
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.app-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.subtitle {
  font-weight: 500;
  color: var(--faint);
  font-size: 13px;
  margin-left: 8px;
}

.banner {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}
.banner-warn {
  background: #fff4e5;
  border: 1px solid #ffcc80;
  color: #8a5400;
}

.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.cards-row {
  display: flex;
  gap: 14px;
  align-items: stretch;
}
.cards-row .card {
  flex: 1;
}
.cards-row .grow {
  flex: 2;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.muted {
  color: var(--muted);
}
.hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.4;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}
.param-grid label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  gap: 4px;
}
.param-grid .unit {
  color: var(--faint);
}
.param-grid input,
.param-grid select {
  padding: 6px 8px;
  border: 1px solid #cbd2d9;
  border-radius: 5px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.param-grid input:disabled {
  background: #f0f2f4;
  color: var(--faint);
}

.limit {
  gap: 6px !important;
}
.limit-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}
.limit-input {
  display: flex;
  align-items: center;
  gap: 6px;
}
.limit-input input {
  flex: 1;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn:active:not(:disabled) {
  background: var(--accent-press);
}
.btn:disabled {
  background: #b8c2cc;
  color: #eceff1;
  cursor: not-allowed;
}
.btn-danger {
  background: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}
.btn-danger:disabled {
  background: #e0b4b4;
}
.btn-ghost {
  background: #eef2f6;
  color: var(--accent);
}
.btn-ghost:hover:not(:disabled) {
  background: #e2e8f0;
}
.btn-ghost:disabled {
  background: #f0f2f4;
  color: var(--faint);
}

.run-card {
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
progress {
  flex: 1;
  height: 16px;
  border-radius: 5px;
  overflow: hidden;
}
progress::-webkit-progress-bar {
  background: #eef2f6;
  border-radius: 5px;
}
progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 5px;
}
progress::-moz-progress-bar {
  background: var(--accent);
}

.results {
  display: flex;
  gap: 14px;
  align-items: stretch;
}
.chart-card {
  flex: 3;
  display: flex;
  flex-direction: column;
}
.table-card {
  flex: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.chart-head h2 {
  margin: 0;
}
.chart-host {
  flex: 1;
  min-height: 360px;
  position: relative;
}
.chart-host canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.table-host {
  overflow: auto;
  max-height: 420px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
thead th {
  position: sticky;
  top: 0;
  background: #eef2f6;
  color: #3e4c59;
  font-weight: 600;
  text-align: right;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
thead th:last-child {
  text-align: left;
}
tbody td {
  padding: 5px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
}
tbody td:last-child {
  text-align: left;
  color: var(--muted);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.app-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 8px 20px;
  font-size: 12px;
}

@media (max-width: 880px) {
  .cards-row,
  .results {
    flex-direction: column;
  }
  .param-grid {
    grid-template-columns: 1fr;
  }
}
