/* ════════════════════════════════════════════════
   PIANO SUITE — COMPONENTS
   ════════════════════════════════════════════════ */

/* ── PAGE TITLES ── */
.page-title {
  font-size: 18px; font-weight: 600;
  letter-spacing: -0.01em; margin-bottom: 4px;
  background: linear-gradient(135deg, var(--text) 60%, var(--a3));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; display: inline-block;
}
.page-sub {
  font-size: 12.5px; color: var(--text2);
  margin-bottom: 18px; line-height: 1.6; font-weight: 300;
}

/* ── CARD ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 18px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.card:hover { border-color: var(--border2); box-shadow: var(--shadow-md); }
.card-title {
  font-family: var(--mono); font-size: 9.5px; color: var(--text3);
  letter-spacing: .10em; text-transform: uppercase; margin-bottom: 14px;
  font-weight: 500;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 12px; font-family: var(--mono);
  border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--border2); background: transparent; color: var(--text);
  position: relative; overflow: hidden; font-weight: 400;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg,rgba(255,255,255,0.06),transparent);
  pointer-events: none;
}
.btn:hover {
  background: var(--surface2); border-color: var(--border2);
  transform: translateY(-1px); box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.primary {
  background: linear-gradient(135deg,var(--a2),var(--a3));
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(0,71,225,0.3); font-weight: 500;
}
.btn.primary:hover {
  box-shadow: 0 4px 16px rgba(0,71,225,0.4);
  transform: translateY(-1px); filter: brightness(1.08);
}
.btn.rec {
  background: var(--danger-bg); color: var(--danger);
  border-color: var(--danger);
  animation: pulseGlow 1.8s ease-in-out infinite;
}
.btn.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* ── BADGES ── */
.badge {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  padding: 2px 9px; border-radius: 100px; font-weight: 500;
  letter-spacing: 0.03em;
}
.badge.ok   { background: var(--success-bg); color: var(--success); }
.badge.warn { background: var(--warn-bg);    color: var(--warn); }
.badge.err  { background: var(--danger-bg);  color: var(--danger); }
.badge.blue { background: var(--accent-soft); color: var(--accent-text); }

/* ── GRID ── */
.grid2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }

/* ── METRIC ── */
.metric { transition: transform .15s var(--ease); }
.metric:hover { transform: scale(1.02); }
.metric .val {
  font-family: var(--mono); font-size: 22px; font-weight: 600;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg,var(--text),var(--text2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.metric .lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }

/* ── CHART WRAP ── */
.chart-wrap {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 14px; margin-bottom: 14px;
  transition: transform .2s var(--ease), border-color .18s, box-shadow .18s;
}
.chart-wrap:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--border2); }
.chart-title {
  font-family: var(--mono); font-size: 9.5px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px;
}
canvas { display: block; width: 100%; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: var(--mono); }
thead th {
  padding: 7px 8px; text-align: left; font-size: 9.5px; color: var(--text3);
  border-bottom: 1px solid var(--border); text-transform: uppercase;
  letter-spacing: .06em; white-space: nowrap;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
tbody td {
  padding: 5px 8px; border-bottom: 1px solid var(--border);
  color: var(--text2); white-space: nowrap; transition: color .1s;
}
tbody tr:hover td { background: var(--surface2); color: var(--text); }
.td-accent { color: var(--accent-text); font-weight: 600; }

/* ── ALERTS ── */
.alert {
  padding: 10px 14px; border-radius: var(--r); font-size: 12px;
  line-height: 1.55; margin-bottom: 12px; border: 1px solid;
  position: relative; overflow: hidden;
}
.alert::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.alert.info { background: var(--accent-soft); border-color: rgba(0,71,225,0.2); color: var(--accent-text); }
.alert.info::before { background: var(--accent); }
.alert.ok   { background: var(--success-bg); border-color: rgba(10,158,114,0.25); color: var(--success); }
.alert.ok::before   { background: var(--success); }
.alert.warn { background: var(--warn-bg); border-color: rgba(184,110,0,0.25); color: var(--warn); }
.alert.warn::before { background: var(--warn); }
.alert.err  { background: var(--danger-bg); border-color: rgba(192,57,43,0.25); color: var(--danger); }
.alert.err::before  { background: var(--danger); }

/* ── STATUS BAR ── */
.status-bar {
  font-size: 11.5px; padding: 9px 13px; border-radius: var(--r);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); margin-bottom: 12px; font-family: var(--mono);
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 8px;
}
.status-bar::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
  animation: blink 2s ease-in-out infinite;
}
.status-bar.ok::before  { background: var(--success); animation: none; }
.status-bar.err::before { background: var(--danger);  animation: blink .6s ease-in-out infinite; }

/* ── RANGE ROW ── */
.range-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.range-row input { flex: 1; }
.range-val {
  font-family: var(--mono); font-size: 12px; color: var(--accent-text);
  min-width: 62px; text-align: right; font-weight: 500;
}

/* ── SCROLL WRAP ── */
.scroll-wrap { overflow-y: auto; max-height: 400px; }
.scroll-wrap::-webkit-scrollbar { width: 4px; }
.scroll-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── PROGRESS ── */
.progress-bar {
  height: 3px; background: var(--surface3); border-radius: 2px;
  overflow: hidden; margin: 6px 0;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg,var(--a1),var(--a3),var(--a5));
  background-size: 200% 100%; border-radius: 2px;
  transition: width .4s var(--ease);
  animation: gradientShift 3s linear infinite;
}

/* ── STRESS BAR ── */
.stress-wrap {
  height: 22px; background: var(--surface2); border-radius: var(--r);
  overflow: hidden; position: relative; margin-bottom: 4px;
}
#stress-bar {
  height: 100%; width: 0%; background: var(--success);
  transition: width .25s var(--ease), background .25s; border-radius: var(--r);
}
#stress-bar-label {
  position: absolute; top: 50%; left: 10px; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px; color: var(--text);
}

/* ── NOTE CHIPS ── */
.note-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.note-chip {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 10px; font-size: 10.5px; font-family: var(--mono);
  border-radius: 6px; border: 1px solid var(--border); cursor: pointer;
  background: var(--surface); color: var(--text2);
  min-width: 42px; font-weight: 400;
}
.note-chip:hover { border-color: var(--accent); color: var(--text); transform: scale(1.05); }
.note-chip.measured { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.note-chip.active {
  background: linear-gradient(135deg,var(--a2),var(--a4));
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(0,71,225,0.3); transform: scale(1.05);
}

/* ── TUNER / FORK DISPLAY ── */
.big-note {
  font-size: 56px; font-weight: 700; text-align: center; line-height: 1;
  margin-bottom: 4px; letter-spacing: -0.02em;
  transition: color .2s, transform .1s;
}
.cents-display {
  font-size: 26px; font-weight: 600; text-align: center;
  padding: 10px 0; font-family: var(--mono); transition: color .2s;
}
.dial-wrap {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 14px; margin-bottom: 14px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.dial-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.conf-bar-wrap { height: 2px; background: var(--border2); border-radius: 1px; margin-top: 8px; overflow: hidden; }
.conf-bar { height: 100%; border-radius: 1px; background: linear-gradient(90deg,var(--a3),var(--a6)); transition: width .12s; }

.fork-display { text-align: center; padding: 22px 0; }
.freq-big {
  font-size: 52px; font-weight: 600; letter-spacing: -2px;
  font-family: var(--display); transition: color .15s;
}
.freq-unit { font-size: 15px; color: var(--text2); margin-left: 5px; font-family: var(--mono); }

/* ── BTAB (tab strip inside panel) ── */
.btab-row {
  display: flex; border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  width: fit-content; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.btab {
  padding: 7px 17px; font-family: var(--mono); font-size: 11px; cursor: pointer;
  color: var(--text3); background: transparent; border-right: 1px solid var(--border);
  font-weight: 400;
}
.btab:last-child { border-right: none; }
.btab.active { color: var(--a5); background: rgba(0,205,184,.10); font-weight: 500; }
.btab:hover:not(.active) { color: var(--text2); background: var(--surface2); }

/* ── INLINE CELL INPUTS (setup table) ── */
.cell-input {
  background: transparent; border: none;
  border-bottom: 1px solid var(--border2);
  color: var(--text); font-family: var(--mono); font-size: 11px;
  padding: 1px 2px; width: 62px;
}
.cell-input:focus { outline: none; border-bottom-color: var(--accent); }
.cell-select {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--mono); font-size: 11px;
  padding: 2px 4px; border-radius: 4px;
}
.cell-select:focus { border-color: var(--accent); outline: none; }
