/* Container */
.pinch-app {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 12px 24px;
  color: #0f172a;
}

/* Cards (blocks) */
.block-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin: 10px 0 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  overflow: hidden;
}

.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.block-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.block-body {
  padding: 10px 12px 14px;
}

/* Controls & buttons */
.inline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 8px;
}

.control input[type="number"] {
  width: 110px;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
}

.btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #0f172a;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: .15s all ease;
  font-size: 13px;
}
.btn:hover { background: #e5e7eb; }
.btn.primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}
.btn.primary:hover { background: #1d4ed8; }
.btn.small { padding: 6px 10px; font-size: 12px; }

.mt-8 { margin-top: 8px; }

/* Streams table */
.streams table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
.streams th, .streams td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
}
.streams thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}
#streamsTable input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
}
.remove-row { color: #991b1b; cursor: pointer; font-weight: 600; }

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}
.metric {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
}
.metric-label { font-size: 12px; color: #475569; margin-bottom: 6px; }
.metric-value { font-size: 16px; font-weight: 600; }

/* Data tables */
.table-scroll {
  max-height: 320px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
#tiTable, #hgTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
#tiTable th, #tiTable td,
#hgTable th, #hgTable td {
  border-bottom: 1px solid #eef2f7;
  padding: 8px 10px;
}
#tiTable thead th, #hgTable thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}

/* Canvases */
.canvas-wrap {
  width: 100%;
  overflow: auto;
}
canvas {
  width: 100% !important;
  max-width: 100%;
  height: 360px !important;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px;
}

/* Responsive tweaks */
@media (max-width: 720px) {
  .metrics { grid-template-columns: 1fr; }
  canvas { height: 300px !important; }
}