/* SmartMetro — rediseño "monitor de escenario" */
:root {
  --bg: #0F1013;
  --bg-deep: #08090B;
  --panel: #15171B;
  --surface: #181A1F;
  --surface-2: #1C1F25;
  --line: #2A2D35;
  --line-soft: #23262D;
  --text: #F2F3F5;
  --text-2: #A3A8B4;
  --text-3: #8A8F9C;
  --dot-off: #3A3E48;
  --accent: #3FE0F0;
  --accent-soft: #10262A;
  --downbeat: #FFB547;
  --downbeat-line: #3A3426;
  --rec: #FF5A5F;
  --rec-soft: #2A1719;
  --rec-text: #FF8A8E;
  --good: #5BE38C;
  --warn: #FFB547;
  --bad: #FF8A8E;
  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --body: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.4 var(--body);
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
i[data-icon] { display: inline-flex; width: 1em; height: 1em; font-style: normal; flex-shrink: 0; }
i[data-icon] svg { width: 100%; height: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dim { color: var(--text-3); }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-2); }
kbd { font: 600 12px var(--body); padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--text-2); }

.loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: var(--bg); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: 1360px; margin: 0 auto; padding: 0 20px; min-height: 64px; display: flex; align-items: center; gap: 12px 32px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); text-decoration: none; }
.brand span { font: 600 19px var(--display); color: var(--text); letter-spacing: -0.2px; }
.tabs { display: flex; gap: 4px; }
.tabs a { min-height: 40px; padding: 0 14px; border-radius: 10px; display: flex; align-items: center; color: var(--text-2); text-decoration: none; font-weight: 500; }
.tabs a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.shortcuts { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-3); margin-left: auto; }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.shortcuts + .topbar-actions { margin-left: 0; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--text-2); font-size: 22px; text-decoration: none;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.rec-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 16px;
  background: var(--rec-soft); color: var(--rec-text); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rec); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- Paneles ---------- */
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 20px; }

/* ---------- Práctica: layout ---------- */
.practice {
  max-width: 1360px; margin: 0 auto; padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  display: grid; gap: 20px;
}

/* ---------- Ajustes ---------- */
.settings { padding: 22px; display: flex; flex-direction: column; gap: 22px; }
.sheet-handle { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font: 600 22px var(--display); }
.group { display: flex; flex-direction: column; gap: 10px; }
.ts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sub-grid { display: flex; flex-direction: column; gap: 6px; }
.opt {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.opt:hover { color: var(--text); }
.opt[aria-pressed="true"] { border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--text); }
.opt.ts { font: 600 16px var(--display); }
.opt.sub { display: flex; align-items: center; gap: 10px; padding: 0 12px; text-align: left; font-weight: 500; }
.sub-dots { display: flex; gap: 4px; align-items: center; width: 40px; }
.sub-dots span { width: 6px; height: 6px; border-radius: 50%; background: #5A5F6B; }
.sub-dots span:first-child { width: 8px; height: 8px; }
.opt[aria-pressed="true"] .sub-dots span { background: var(--accent); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 10px; flex-wrap: wrap; }
#sel-grouping button { font: 600 14px var(--display); }
.accent-help { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--text-3); }
.link-btn { background: none; border: 0; padding: 6px 4px; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.practice-block { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.practice-block .check { min-height: 36px; align-items: flex-start; font-size: 14px; color: var(--text); }
.practice-block .check span { display: flex; flex-direction: column; gap: 2px; }
.practice-block .check small, .check.small { font-size: 12px; color: var(--text-3); }
.stepper-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--text-2); }
.stepper-row.disabled { opacity: .45; pointer-events: none; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.stepper button { width: 32px; height: 34px; border: 0; background: none; color: var(--text); font-size: 18px; cursor: pointer; }
.stepper output { min-width: 30px; text-align: center; font: 600 15px var(--display); color: var(--text); }
.btn-secondary { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-weight: 500; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent); }
.btn-secondary:disabled { opacity: .5; cursor: default; }
.calib-status { margin: 0; font-size: 14px; }
.calib-status b { font: 600 15px var(--display); }
.calib-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.calib-help { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.pending-note { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.sub-check { align-items: flex-start; gap: 10px; padding-top: 4px; font-size: 14px; color: var(--text); }
.sub-check input { margin-top: 2px; }
.sub-check span { display: flex; flex-direction: column; gap: 2px; }
.sub-check small { font-size: 12px; color: var(--text-3); }
.sound-list { display: flex; flex-direction: column; }
.sound-row { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.sound-row label { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: 15px; cursor: pointer; }
.sound-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.preview-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2);
  display: grid; place-items: center; cursor: pointer; font-size: 18px;
}
.btn-primary {
  height: 56px; border-radius: 16px; border: 0; background: var(--accent); color: var(--bg);
  font-weight: 600; font-size: 16px; cursor: pointer;
}

/* ---------- Metrónomo ---------- */
.metronome { padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 24px; min-width: 0; }
.play-status { margin: 0; height: 22px; font-size: 14px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.play-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.play-status:empty::before { display: none; }
.tempo-hero { width: 100%; display: flex; flex-direction: column; align-items: center; }
.bpm-row { display: flex; align-items: center; gap: 22px; margin-top: 4px; }
.bpm-display { display: flex; flex-direction: column; align-items: center; width: 190px; }
.bpm-value { font: 600 112px/1 var(--display); letter-spacing: -4px; font-variant-numeric: tabular-nums; }
.bpm-unit { font-size: 13px; color: var(--text-2); letter-spacing: 1px; margin-top: 4px; }
.round-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-size: 28px; line-height: 1; cursor: pointer; display: grid; place-items: center;
  touch-action: manipulation; user-select: none;
}
.round-btn:active { transform: scale(.96); }
.round-btn.lg { width: 66px; height: 66px; }
.round-btn.tap { font: 600 15px var(--display); letter-spacing: 1px; }
.round-btn.rec { border-color: #5A2B2E; background: var(--rec-soft); }
.rec-shape { width: 22px; height: 22px; border-radius: 50%; background: var(--rec); transition: border-radius .15s; }
.bpm-slider { width: 100%; max-width: 560px; margin-top: 20px; display: flex; flex-direction: column; gap: 4px; }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); }
.slider { --p: 33%; -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; cursor: pointer; margin: 0; }
.slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--p), var(--line) var(--p)); }
.slider::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
.slider::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--text); border: 0; box-shadow: 0 0 0 4px var(--bg); }
.slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--text); border: 0; box-shadow: 0 0 0 4px var(--bg); }

.compact-tempo {
  display: none; width: 100%; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
}
.compact-tempo b { font: 600 17px var(--display); color: var(--text); }
.mini-beats { display: flex; gap: 4px; }
.mini-beats span { width: 16px; height: 6px; border-radius: 3px; background: var(--dot-off); }
.mini-beats span.on { background: var(--accent); }
.mini-beats span.on.down { background: var(--downbeat); }
.mini-beats span.gstart:not(:first-child) { margin-left: 5px; }

.pads-wrap { width: 100%; max-width: 620px; display: flex; flex-direction: column; gap: 10px; }
.pads-row { display: flex; align-items: center; gap: 12px; }
/* Compás escrito como en la partitura: numerador sobre denominador */
.ts-badge {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: 700 30px/1 var(--display); color: var(--text); min-width: 40px;
}
.ts-badge span { display: block; padding: 2px 4px; }
.ts-badge span + span { border-top: 2px solid var(--text-2); }
.ts-badge.den-8 span + span { color: var(--accent); }
.ts-badge.changed span + span { animation: denFlash .6s ease; }
@keyframes denFlash { 0% { transform: scale(1.5); } 100% { transform: none; } }
.meter-info { margin: 0; text-align: center; font-size: 14px; color: var(--text-2); }
.meter-info b { color: var(--text); font-weight: 600; }
.meter-info .note { font-size: 18px; color: var(--accent); vertical-align: -1px; }
.pads { flex: 1; min-width: 0; display: flex; gap: 10px; }
.pads .pad { flex: 1 1 0; min-width: 0; }
.pads.many { gap: 6px; }
/* Muchos tiempos o subdivisiones: puntos más pequeños para que quepan en el pad */
.pads.dense .pad-subs { gap: 3px; }
.pads.dense .pad-subs span { width: 4px; height: 4px; }
.pads.dense .pad-subs span:first-child { width: 6px; height: 6px; }
.pad-subs { max-width: calc(100% - 6px); align-items: center; }
/* Inicio de grupo encendido: anillo interior para distinguirlo de un tiempo normal */
.pad.on.medium { box-shadow: inset 0 0 0 3px rgba(15, 16, 19, .55); }
.pad.gstart:not(:first-child) { margin-left: 10px; }          /* separación visual entre grupos */
.pad.medium .pad-num { color: var(--text); }
.pad.medium { border-color: #3A3E48; }
.pad {
  height: 84px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  transition: background-color 60ms; cursor: pointer; padding: 0; color: inherit; font: inherit;
}
.pad:hover { border-color: #4A4F5B; }
/* Nivel de acento: 3 rayitas (fuerte), 2 (medio), 1 (normal), ninguna (silencio) */
.pad-level { display: flex; flex-direction: column-reverse; gap: 2px; height: 12px; justify-content: flex-start; }
.pad-level span { width: 14px; height: 2px; border-radius: 1px; background: var(--dot-off); }
.pad-level span.lit { background: var(--text-2); }
.pad.down .pad-level span.lit { background: var(--downbeat); }
.pad.on .pad-level span.lit { background: var(--bg); }
.pad.on .pad-level span { background: rgba(15, 16, 19, .25); }
.pad.mute { border-style: dashed; background: transparent; }
.pad.mute .pad-num { color: var(--text-3); text-decoration: line-through; }
.pad.mute.on { background: transparent; border: 2px dashed var(--accent); }
.pad.mute.on .pad-num { color: var(--accent); }
/* Compás en silencio: los pads se mueven en hueco, para que veas dónde va el pulso */
.pads.silent .pad.on { background: transparent; border: 2px solid var(--accent); }
.pads.silent .pad.on .pad-num { color: var(--accent); }
.pads.silent .pad.on.down { border-color: var(--downbeat); }
.pads.silent .pad.on.down .pad-num { color: var(--downbeat); }
.pads.silent .pad.on .pad-subs span.cur { background: var(--accent); }
/* Cuenta previa */
.pads.counting .pad.on { background: var(--text-2); border-color: var(--text-2); }
.pad.down { border-color: var(--downbeat-line); }
.pad-num { font: 600 26px var(--display); color: var(--text-2); }
.pad.down .pad-num { color: var(--downbeat); }
.pad-subs { display: flex; gap: 6px; }
.pad-subs span { width: 6px; height: 6px; border-radius: 50%; background: var(--dot-off); }
.pad-subs span:first-child { width: 8px; height: 8px; }
.pad.on { background: var(--accent); border-color: var(--accent); }
.pad.on.down { background: var(--downbeat); border-color: var(--downbeat); }
.pad.on .pad-num { color: var(--bg); }
.pad.on .pad-subs span { background: rgba(15, 16, 19, .3); }
.pad.on .pad-subs span.cur { background: var(--bg); }
.pads.many .pad { height: 72px; }
.pads.many .pad-num { font-size: 20px; }

.config-row {
  width: 100%; min-height: 52px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 16px; cursor: pointer; text-align: left; color: var(--text-2);
}
.config-row b { font: 600 16px var(--display); color: var(--text); white-space: nowrap; }
.config-row > span:not(.sep) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.config-row .sep { width: 1px; height: 18px; background: var(--line); }
.config-row .chev { margin-left: auto; font-size: 20px; color: var(--text-3); }

.transport { display: flex; align-items: flex-start; justify-content: center; gap: 36px; }
.tbtn { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.play-btn {
  width: 92px; height: 92px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--accent); color: var(--bg); font-size: 40px; transition: transform .1s;
}
.play-btn:active { transform: scale(.96); }

/* ---------- Análisis ---------- */
.analysis { padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.analysis-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.analysis-idle { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; color: var(--text-2); padding: 20px 8px; }
.analysis-idle p { margin: 6px 0 0; max-width: 280px; line-height: 1.5; }
.analysis-idle .hint { font-size: 13px; color: var(--text-3); }
.idle-icon { font-size: 36px; color: var(--text-3); }
.analysis-live { display: flex; flex-direction: column; gap: 14px; }
.noise-warning { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--rec-soft); color: var(--rec-text); font-weight: 600; font-size: 13px; }
.acc-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.acc { display: flex; flex-direction: column; }
.acc-value { font: 600 68px/1 var(--display); letter-spacing: -2px; color: var(--good); }
.acc-value[data-level="medium"] { color: var(--warn); }
.acc-value[data-level="low"] { color: var(--bad); }
.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.segmented button { min-height: 34px; min-width: 40px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--line); color: var(--text); font-weight: 600; }
.stat-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-card { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 13px; color: var(--text-2); }
.stat-value { font: 600 28px var(--display); font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12px; color: var(--text-3); }
.grades-card { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.grades-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); gap: 2px; }
.grades-bar span { height: 100%; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.perfect { background: var(--good); }
.good { background: var(--accent); }
.off { background: var(--warn); }
.miss { background: #5A5F6B; }
.grades-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; font-size: 12px; color: var(--text-2); }
.grades-legend b, .grades-extra b { color: var(--text); font-variant-numeric: tabular-nums; }
.grades-extra { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--line); padding-top: 8px; }
.silent-card { padding: 10px 14px; border-radius: 14px; border: 1px dashed var(--accent); display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.silent-card b { font: 600 16px var(--display); }
.sens-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.sens-row .slider { flex: 1; height: 28px; }
.slider.small::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -6px; }
.compare { margin: 0; font-size: 13px; }
.strip-card { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.strip-head, .strip-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }
.strip-foot { color: var(--text-3); margin-top: 6px; }
.hit-strip { position: relative; height: 52px; margin-top: 10px; }
.strip-axis { position: absolute; left: 0; right: 0; top: 25px; height: 2px; background: var(--line); }
.strip-center { position: absolute; left: 50%; top: 2px; width: 2px; height: 48px; margin-left: -1px; background: var(--accent); }
.hit { position: absolute; top: 26px; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: rgba(242, 243, 245, .45); transition: left .15s; }
.hit.recent { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--text); }
.wave-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.waveform { width: 100%; height: 56px; display: block; border-radius: 14px; background: var(--surface-2); }
.btn-danger {
  height: 54px; border-radius: 16px; border: 0; background: var(--rec); color: var(--bg); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; font-size: 15px; margin-top: auto;
}
.btn-danger i { font-size: 20px; }

/* ---------- Historial ---------- */
.history { max-width: 1360px; margin: 0 auto; padding: 16px 20px calc(32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 20px; }
.history-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.history-head h1 { margin: 0; font: 600 30px var(--display); letter-spacing: -0.5px; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.sum-card { padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 2px; }
.sum-value { font: 600 30px var(--display); font-variant-numeric: tabular-nums; }
.history-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.sessions { flex: 999 1 560px; min-width: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th { text-align: left; padding: 14px 10px; font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-2); }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
.col-acc { width: 190px; }
td { padding: 10px; border-top: 1px solid var(--line-soft); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #181B20; }
tbody tr.selected { background: #1A1D23; box-shadow: inset 3px 0 0 var(--accent); }
.t-date { font-weight: 500; }
.t-bpm { font: 600 16px var(--display); }
.acc-cell { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 3px; }
.acc-num { width: 42px; text-align: right; font: 600 14px var(--display); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.sq-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; cursor: pointer; font-size: 18px; text-decoration: none; }
.sq-btn:hover { color: var(--text); }
.sq-btn.danger:hover { color: var(--bad); }
.detail { flex: 1 1 320px; max-width: 400px; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.detail h2 { margin: 2px 0 0; font: 600 22px var(--display); }
.hist { height: 120px; display: flex; align-items: flex-end; gap: 4px; margin-top: 10px; border-bottom: 1px solid var(--line); }
.hist span { flex: 1; min-height: 2px; border-radius: 4px 4px 0 0; background: #4A4F5B; }
.hist span.center { background: var(--accent); }
.hist-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-top: 6px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini-stats b { white-space: nowrap; }
.mini-stats div { padding: 10px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; }
.mini-stats b { font: 600 20px var(--display); }
.mini-stats span { font-size: 12px; color: var(--text-2); }
.detail audio, .item-audio audio { width: 100%; height: 40px; color-scheme: dark; }

.sessions-title { padding: 16px 16px 0; }
.session-list { list-style: none; margin: 0; padding: 0 16px; }
.session-item { border-bottom: 1px solid var(--line-soft); }
.session-item:last-child { border-bottom: 0; }
.item-main { width: 100%; display: flex; gap: 14px; align-items: center; padding: 14px 0; background: none; border: 0; cursor: pointer; text-align: left; }
.bpm-box { width: 58px; height: 58px; flex-shrink: 0; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bpm-box b { font: 600 20px/1.1 var(--display); }
.bpm-box span { font-size: 11px; color: var(--text-2); }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.item-date { font-size: 15px; font-weight: 500; }
.item-meta { font-size: 13px; color: var(--text-2); }
.item-audio { display: flex; gap: 8px; align-items: center; padding: 0 0 14px; }
.item-audio audio { flex: 1; min-width: 0; }

.empty { padding: 60px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--text-3); }
.empty-icon { font-size: 56px; }
.empty h2 { color: var(--text-2); font: 600 20px var(--display); margin: 14px 0 6px; }
.empty p { margin: 0; }

/* ---------- Diálogo y snackbar ---------- */
.dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 24px; padding: 24px; width: min(340px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dialog h2 { margin: 0 0 12px; font: 600 20px var(--display); }
.dialog p { margin: 0 0 22px; color: var(--text-2); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.text-btn { min-height: 44px; background: none; border: 0; padding: 0 14px; border-radius: 12px; cursor: pointer; color: var(--text); font-weight: 500; }
.text-btn:hover { background: var(--surface-2); }
.text-btn.danger { color: var(--bad); }
.snackbar {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, calc(100% + 40px)); transition: transform .25s ease, visibility .25s; visibility: hidden;
  display: flex; align-items: center; gap: 16px; min-width: 260px; max-width: calc(100vw - 32px);
  padding: 12px 12px 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.snackbar.show { transform: translate(-50%, 0); visibility: visible; }
.snackbar.error { background: var(--rec); }
.snackbar a { margin-left: auto; color: var(--bg); font-weight: 700; padding: 6px 8px; }

/* =========================================================
   Escritorio (≥ 1100 px): tres columnas siempre visibles
   ========================================================= */
@media (min-width: 1100px) {
  .mobile-only, .sheet-only, .config-row, .sheet-backdrop { display: none !important; }
  .practice { grid-template-columns: 300px minmax(0, 1fr) 380px; align-items: start; padding-top: 4px; }
  /* Las tres columnas ocupan el alto de la ventana; los ajustes y el análisis hacen scroll por dentro */
  .practice > .panel { height: calc(100dvh - 92px); min-height: 620px; overflow-y: auto; position: sticky; top: 72px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .metronome { justify-content: center; gap: 28px; padding: 32px; background: #13151A; }
  .bpm-display { width: 280px; }
  .bpm-value { font-size: 168px; letter-spacing: -7px; }
  .round-btn { width: 60px; height: 60px; }
  .round-btn.lg { width: 70px; height: 70px; }
  .pad { height: 112px; border-radius: 18px; }
  .pad-num { font-size: 34px; }
  .pads.many .pad { height: 96px; }
  .play-btn { width: 100px; height: 100px; }
}

/* =========================================================
   Móvil y tableta (< 1100 px)
   ========================================================= */
@media (max-width: 1099px) {
  .tabs, .shortcuts, .desktop-only { display: none !important; }
  .topbar-inner { padding: 0 12px 0 20px; }
  .practice { max-width: 560px; min-height: calc(100dvh - 64px - env(safe-area-inset-top)); grid-template-rows: auto; padding-top: 0; }
  .metronome { background: none; border: 0; padding: 0; gap: 22px; min-height: calc(100dvh - 96px - env(safe-area-inset-top)); }
  .transport { margin-top: auto; width: 100%; justify-content: space-between; padding: 0 6px; }
  .play-status { justify-content: center; }

  /* Ajustes como hoja inferior */
  .settings {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 88dvh; overflow-y: auto;
    border-radius: 28px 28px 0 0; border-width: 1px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); visibility: hidden;
  }
  body.sheet-open .settings { transform: none; visibility: visible; }
  .sheet-handle { display: block; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--dot-off); }
  .ts-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .sub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); }
  body.sheet-open { overflow: hidden; }

  /* Análisis: solo mientras se graba (vista "Grabando") */
  .analysis { display: none; background: none; border: 0; padding: 0; }
  .analysis-head { display: none; }
  body.has-pending-recordings:not(.recording) .practice { display: flex; flex-direction: column; }
  body.has-pending-recordings:not(.recording) .analysis { display: flex; order: -1; }
  body.has-pending-recordings:not(.recording) .analysis > :not(#pending-recordings) { display: none; }
  body.recording .analysis { display: flex; }
  body.recording .tempo-hero,
  body.recording .pads-wrap,
  body.recording .config-row,
  body.recording .transport,
  body.recording .play-status { display: none; }
  body.recording .compact-tempo { display: flex; }
  body.recording .metronome { min-height: 0; }
  body.recording .practice { display: flex; flex-direction: column; gap: 18px; }
  body.recording .analysis { flex: 1; }
  body.recording .btn-danger { margin-top: auto; position: sticky; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .acc-value { font-size: 76px; letter-spacing: -3px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sessions { background: none; border: 0; }
  .sessions-title, .session-list { padding-left: 0; padding-right: 0; }
}

@media (max-width: 380px) {
  .bpm-value { font-size: 92px; }
  .bpm-display { width: 150px; }
  .bpm-row { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.disabled { opacity: .45; pointer-events: none; }
.bpm-value.fractional { font-size: clamp(56px, 12vw, 100px); letter-spacing: -.04em; }
td small { font-size: 12px; color: var(--text-3); }
