/* ── HRV Monitor page ────────────────────────────── */

/* HERO */
.hrv-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--size-6);
    padding: clamp(var(--size-6), 4vw, var(--size-8)) clamp(var(--size-5), 3vw, var(--size-8)) var(--size-6);
    background:
        radial-gradient(ellipse 70% 80% at 80% 50%, rgba(236,72,153,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 20% 30%, var(--accent-a4) 0%, transparent 70%),
        var(--site-panel);
    border: 1px solid var(--site-border);
    border-radius: var(--radius-4);
    margin-bottom: var(--size-5);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

[data-theme="renew"] .hrv-hero {
    background:
        radial-gradient(ellipse 70% 80% at 80% 50%, rgba(245,158,11,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 20% 30%, var(--accent-a4) 0%, transparent 70%),
        var(--site-panel);
}

.hrv-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(236,72,153,0.04) 0%, transparent 60%);
    pointer-events: none;
}

[data-theme="renew"] .hrv-hero::before {
    background: radial-gradient(ellipse, rgba(245,158,11,0.04) 0%, transparent 60%);
}

.hrv-hero h1 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.hrv-lede {
    margin: 0;
    max-width: 58ch;
    color: var(--site-text-muted);
    font-size: 1rem;
    line-height: 1.75;
}

.hrv-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--size-3);
    align-items: center;
    align-self: center;
    flex-shrink: 0;
}

.hrv-badge {
    display: flex;
    align-items: center;
    gap: var(--size-2);
    padding: 0.5em 1em;
    border-radius: var(--radius-3);
    border: 1px solid var(--site-border);
    background: rgba(236,72,153,0.04);
    font-size: 0.85rem;
    font-weight: var(--font-weight-6);
    color: var(--site-text-muted);
    white-space: nowrap;
    transition: all 0.2s var(--ease-out);
}

[data-theme="renew"] .hrv-badge {
    background: rgba(245,158,11,0.05);
}

.hrv-badge:hover {
    background: rgba(236,72,153,0.08);
    border-color: rgba(236,72,153,0.2);
    transform: translateY(-1px);
}

[data-theme="renew"] .hrv-badge:hover {
    background: rgba(245,158,11,0.1);
    border-color: rgba(245,158,11,0.3);
}

.hrv-badge-icon { font-size: 1.1rem; }

/* SHELL */
.hrv-shell {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: var(--size-5);
    align-items: start;
}

/* CARDS */
.hrv-card {
    padding: clamp(var(--size-4), 3vw, var(--size-5)) clamp(var(--size-4), 3vw, var(--size-6));
    display: grid;
    gap: var(--size-4);
    margin-bottom: var(--size-4);
    transition: box-shadow 0.3s var(--ease-out);
}

.hrv-card:last-child { margin-bottom: 0; }

.hrv-card:hover {
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--site-border) inset;
}

.hrv-sidebar { display: grid; gap: 0; }

.hrv-card-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: var(--font-weight-7);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--site-text-muted);
}

/* INPUT METHOD TABS */
.input-method-tabs {
    display: flex;
    gap: var(--size-2);
    border-bottom: 1px solid var(--site-border);
    padding-bottom: var(--size-3);
}

.imt-tab {
    padding: 0.5em 1em;
    border: 1px solid var(--site-border);
    border-radius: var(--radius-3);
    background: transparent;
    font: inherit;
    font-size: 0.85rem;
    font-weight: var(--font-weight-6);
    color: var(--site-text-muted);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.imt-tab:hover {
    background: var(--gray-1);
    color: var(--site-text);
    border-color: var(--gray-4);
}

[data-theme="renew"] .imt-tab:hover {
    background: rgba(20,184,166,0.06);
    border-color: rgba(20,184,166,0.2);
    color: var(--teal-4);
}

.imt-tab.imt-active {
    background: rgba(236,72,153,0.08);
    border-color: rgba(236,72,153,0.3);
    color: #be185d;
    font-weight: var(--font-weight-7);
    box-shadow: 0 0 0 1px var(--site-border) inset;
}

[data-theme="renew"] .imt-tab.imt-active {
    background: rgba(245,158,11,0.1);
    border-color: rgba(245,158,11,0.35);
    color: #f59e0b;
}

.input-panel.hidden { display: none; }

.input-hint {
    margin: 0;
    font-size: 0.88rem;
    color: var(--site-text-muted);
    line-height: 1.65;
}

/* TAP BUTTON */
.tap-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--size-2);
    width: 100%;
    padding: clamp(var(--size-4), 3vw, var(--size-5)) var(--size-4);
    background: linear-gradient(135deg, rgba(236,72,153,0.1), rgba(244,114,182,0.06));
    border: 2px solid rgba(236,72,153,0.25);
    border-radius: var(--radius-4);
    cursor: pointer;
    font: inherit;
    transition: all 0.15s var(--ease-out);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

[data-theme="renew"] .tap-btn {
    background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(251,191,36,0.06));
    border-color: rgba(245,158,11,0.25);
}

.tap-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(236,72,153,0.08) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

[data-theme="renew"] .tap-btn::after {
    background: radial-gradient(circle at 50% 50%, rgba(245,158,11,0.08) 0%, transparent 70%);
}

.tap-btn:hover::after {
    opacity: 1;
}

.tap-btn:active,
.tap-btn.tapped {
    transform: scale(0.96);
    background: linear-gradient(135deg, rgba(236,72,153,0.2), rgba(244,114,182,0.14));
    border-color: rgba(236,72,153,0.55);
}

[data-theme="renew"] .tap-btn:active,
[data-theme="renew"] .tap-btn.tapped {
    background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(251,191,36,0.14));
    border-color: rgba(245,158,11,0.55);
}

.tap-heart {
    font-size: 2.6rem;
    color: #ec4899;
    transition: transform 0.15s var(--ease-out);
    line-height: 1;
}

[data-theme="renew"] .tap-heart {
    color: #f59e0b;
}

.tap-btn.tapped .tap-heart {
    animation: heartpulse 0.35s ease;
}

@keyframes heartpulse {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

.tap-label {
    font-size: 1rem;
    font-weight: var(--font-weight-7);
    color: #be185d;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

[data-theme="renew"] .tap-label {
    color: #d97706;
}

.tap-hint {
    margin: 0;
    font-size: 0.82rem;
    color: var(--site-text-muted);
    text-align: center;
    font-style: italic;
}

/* BLUETOOTH PANEL */
.bt-unsupported {
    display: flex;
    align-items: flex-start;
    gap: var(--size-3);
    padding: var(--size-4);
    background: rgba(217,119,6,0.06);
    border: 1px solid rgba(217,119,6,0.25);
    border-radius: var(--radius-3);
    font-size: 0.88rem;
    color: #92400e;
    line-height: 1.65;
}

.bt-unsupported-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

.bt-connect-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--size-3);
}

.bt-connect-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    color: white;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 18px rgba(59,130,246,0.35), 0 0 0 1px var(--site-border) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--size-2);
    transition: all 0.2s var(--ease-out);
}

[data-theme="renew"] .bt-connect-btn {
    background: linear-gradient(135deg, var(--teal-6), var(--teal-7));
    box-shadow: 0 4px 18px rgba(20,184,166,0.3), 0 0 0 1px var(--site-border) inset;
}

.bt-connect-btn:hover:not(:disabled) { background: linear-gradient(135deg, #2563eb, #1e40af); transform: translateY(-1px); }

[data-theme="renew"] .bt-connect-btn:hover:not(:disabled) { background: linear-gradient(135deg, var(--teal-5), var(--teal-6)); }

.bt-connect-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.bt-icon { font-size: 1rem; }

.bt-device-info {
    display: grid;
    gap: var(--size-3);
    padding: var(--size-4);
    background: rgba(59,130,246,0.04);
    border: 1px solid rgba(59,130,246,0.18);
    border-radius: var(--radius-3);
}

[data-theme="renew"] .bt-device-info {
    background: rgba(20,184,166,0.05);
    border-color: rgba(20,184,166,0.18);
}

.bt-device-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--size-3);
    flex-wrap: wrap;
}

.bt-device-name {
    font-weight: var(--font-weight-7);
    font-size: 1rem;
    color: var(--site-text);
}

.bt-status-badge {
    padding: 0.25em 0.75em;
    border-radius: var(--radius-round);
    font-size: 0.78rem;
    font-weight: var(--font-weight-7);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.bt-status-badge[data-status="connected"] {
    background: rgba(5,150,105,0.1);
    color: #065f46;
    border: 1px solid rgba(5,150,105,0.25);
}

.bt-status-badge[data-status="connecting"],
.bt-status-badge[data-status="reconnecting"] {
    background: rgba(59,130,246,0.08);
    color: #1e40af;
    border: 1px solid rgba(59,130,246,0.2);
    animation: btpulse 1.2s ease-in-out infinite;
}

[data-theme="renew"] .bt-status-badge[data-status="connecting"],
[data-theme="renew"] .bt-status-badge[data-status="reconnecting"] {
    background: rgba(20,184,166,0.08);
    color: var(--teal-4);
    border-color: rgba(20,184,166,0.2);
}

.bt-status-badge[data-status="disconnected"] {
    background: rgba(107,114,128,0.08);
    color: #6b7280;
    border: 1px solid rgba(107,114,128,0.2);
}

@keyframes btpulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

.bt-signal-row {
    display: flex;
    align-items: center;
    gap: var(--size-3);
    font-size: 0.85rem;
    color: var(--site-text-muted);
}

.bt-signal-label { flex-shrink: 0; }

.bt-signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
}

.bt-bar {
    display: inline-block;
    width: 6px;
    border-radius: 2px 2px 0 0;
    background: var(--gray-3, #d1d5db);
    transition: background 0.4s var(--ease-out), transform 0.2s;
}

.bt-bar[data-idx="0"] { height: 5px; }
.bt-bar[data-idx="1"] { height: 9px; }
.bt-bar[data-idx="2"] { height: 13px; }
.bt-bar[data-idx="3"] { height: 17px; }

.bt-bar.active {
    background: #3b82f6;
    transform: scaleY(1.1);
}

[data-theme="renew"] .bt-bar.active {
    background: var(--teal-5);
}

.bt-signal-text {
    font-variant-numeric: tabular-nums;
    min-width: 60px;
}

.bt-rr-live {
    font-size: 0.83rem;
    color: var(--site-text-muted);
}

.bt-rr-live strong {
    font-variant-numeric: tabular-nums;
    color: var(--site-text);
}

.bt-disconnect-btn {
    width: 100%;
    text-align: center;
}

/* CAMERA */
.camera-wrap {
    position: relative;
    background: #000;
    border-radius: var(--radius-3);
    overflow: hidden;
    aspect-ratio: 4/3;
    max-height: 180px;
    box-shadow: var(--shadow-md);
}

.camera-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}

.camera-wrap canvas {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.camera-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cam-signal {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(236,72,153,0.22);
    border: 2px solid rgba(236,72,153,0.45);
    transition: transform 0.2s var(--ease-out), background 0.2s;
}

[data-theme="renew"] .cam-signal {
    background: rgba(245,158,11,0.22);
    border-color: rgba(245,158,11,0.45);
}

.cam-signal.beat {
    animation: cambeat 0.3s ease;
}

@keyframes cambeat {
    0%   { transform: scale(1);    background: rgba(236,72,153,0.22); }
    40%  { transform: scale(1.6);  background: rgba(236,72,153,0.65); }
    100% { transform: scale(1);    background: rgba(236,72,153,0.22); }
}

[data-theme="renew"] @keyframes cambeat {
    0%   { transform: scale(1);    background: rgba(245,158,11,0.22); }
    40%  { transform: scale(1.6);  background: rgba(245,158,11,0.65); }
    100% { transform: scale(1);    background: rgba(245,158,11,0.22); }
}

.cam-btn {
    background: linear-gradient(135deg, #ec4899, #be185d);
    border: none;
    color: white;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 18px rgba(236,72,153,0.35), 0 0 0 1px var(--site-border) inset;
    transition: all 0.2s var(--ease-out);
}

[data-theme="renew"] .cam-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 18px rgba(245,158,11,0.3), 0 0 0 1px var(--site-border) inset;
}

.cam-btn:hover { background: linear-gradient(135deg, #db2777, #9d174d); transform: translateY(-1px); }

[data-theme="renew"] .cam-btn:hover { background: linear-gradient(135deg, #fbbf24, #b45309); }

.cam-btn:active { transform: translateY(0) scale(0.98); }

.cam-status {
    margin: 0;
    font-size: 0.82rem;
    color: var(--site-text-muted);
    text-align: center;
    font-style: italic;
}

/* METRICS GRID */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--size-3);
}

.metric-tile {
    background: var(--site-panel);
    border: 1px solid var(--site-border);
    border-radius: var(--radius-3);
    padding: var(--size-3) var(--size-4);
    display: grid;
    gap: 2px;
    transition: box-shadow 0.2s var(--ease-out), border-color 0.2s, background var(--duration-slow);
}

.metric-tile:hover {
    border-color: var(--site-border-strong);
    box-shadow: var(--shadow-sm);
}

.metric-value {
    font-size: 1.9rem;
    font-weight: var(--font-weight-9);
    font-variant-numeric: tabular-nums;
    color: var(--site-text);
    line-height: 1;
    transition: color 0.3s;
}

.metric-value.good   { color: #059669; }
[data-theme="renew"] .metric-value.good { color: #34d399; }

.metric-value.fair   { color: #d97706; }
[data-theme="renew"] .metric-value.fair { color: #fbbf24; }

.metric-value.poor   { color: #dc2626; }
[data-theme="renew"] .metric-value.poor { color: #f87171; }

.metric-label {
    font-size: 0.75rem;
    font-weight: var(--font-weight-7);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--site-text-muted);
}

.metric-unit {
    font-weight: var(--font-weight-4);
    font-size: 0.72rem;
    text-transform: none;
    letter-spacing: 0;
}

.metric-sub {
    font-size: 0.75rem;
    color: var(--site-text-muted);
    font-style: italic;
}

/* COHERENCE BAR */
.coherence-bar-wrap {
    display: grid;
    gap: var(--size-2);
}

.coh-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--site-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.coh-track {
    position: relative;
    height: 12px;
    border-radius: var(--radius-round);
    background: linear-gradient(to right,
        rgba(220,38,38,0.2) 0%,
        rgba(217,119,6,0.2) 40%,
        rgba(5,150,105,0.2) 80%,
        rgba(5,150,105,0.35) 100%
    );
    border: 1px solid var(--site-border);
    overflow: visible;
}

.coh-fill {
    height: 100%;
    border-radius: var(--radius-round);
    background: linear-gradient(to right, #f87171, #fbbf24, #34d399);
    transition: width 0.8s var(--ease-out);
}

.coh-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--site-panel-strong);
    border: 2px solid #ec4899;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: left 0.8s var(--ease-out);
}

[data-theme="renew"] .coh-marker {
    border-color: #f59e0b;
}

.coh-score-row {
    display: flex;
    align-items: baseline;
    gap: var(--size-2);
    font-size: 0.85rem;
    color: var(--site-text-muted);
}

.coh-score-value {
    font-size: 1.5rem;
    font-weight: var(--font-weight-9);
    color: var(--site-text);
    font-variant-numeric: tabular-nums;
}

.coh-score-max { font-size: 0.78rem; }

/* NS ZONE */
.ns-zone {
    display: flex;
    gap: var(--size-4);
    align-items: flex-start;
}

.nsz-icon {
    font-size: 2.4rem;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.3s var(--ease-out);
}

.ns-zone:hover .nsz-icon {
    transform: scale(1.1);
}

.nsz-name {
    font-weight: var(--font-weight-7);
    font-size: 1rem;
    color: var(--site-text);
    margin-bottom: var(--size-1);
}

.nsz-desc {
    font-size: 0.88rem;
    color: var(--site-text-muted);
    line-height: 1.65;
}

.ns-tip {
    display: flex;
    gap: var(--size-3);
    align-items: flex-start;
    padding: var(--size-3) var(--size-4);
    background: rgba(236,72,153,0.04);
    border-left: 3px solid #ec4899;
    border-radius: var(--radius-3);
    transition: box-shadow 0.2s var(--ease-out);
}

[data-theme="renew"] .ns-tip {
    background: rgba(245,158,11,0.04);
    border-left-color: #f59e0b;
}

.ns-tip:hover {
    box-shadow: var(--shadow-sm);
}

.ns-tip .tip-icon { font-size: 1.1rem; flex-shrink: 0; }
.ns-tip p { margin: 0; font-size: 0.88rem; color: var(--site-text-muted); line-height: 1.65; }

/* SESSION CONTROLS */
.session-ctrl-row {
    display: flex;
    gap: var(--size-4);
}

.session-elapsed-wrap,
.session-beats-wrap {
    display: grid;
    gap: 2px;
}

.session-elapsed,
.session-beats {
    font-size: 1.7rem;
    font-weight: var(--font-weight-9);
    font-variant-numeric: tabular-nums;
    color: var(--site-text);
    line-height: 1;
}

.session-elapsed-label,
.session-beats-label {
    font-size: 0.72rem;
    color: var(--site-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.session-btn-row {
    display: flex;
    gap: var(--size-3);
    flex-wrap: wrap;
}

.sess-btn {
    flex: 1;
    text-align: center;
    min-width: 130px;
    transition: all 0.2s var(--ease-out);
}

/* CHART CARDS */
.chart-card {
    gap: var(--size-3);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--size-4);
    flex-wrap: wrap;
}

.chart-unit {
    font-size: 0.75rem;
    font-weight: var(--font-weight-4);
    text-transform: none;
    letter-spacing: 0;
    color: var(--site-text-muted);
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: var(--size-2);
    font-size: 0.8rem;
    color: var(--site-text-muted);
}

.cl-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.cl-rr  { background: #ec4899; }
[data-theme="renew"] .cl-rr { background: #f59e0b; }

.cl-avg { background: rgba(139,92,246,0.65); }
[data-theme="renew"] .cl-avg { background: rgba(6,182,212,0.65); }

.cl-lf  { background: #f97316; }
.cl-hf  { background: #0ea5e9; }

.chart-wrap {
    position: relative;
    height: 200px;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-range-info {
    font-size: 0.78rem;
    color: var(--site-text-muted);
    padding-top: var(--size-2);
    border-top: 1px solid var(--site-border);
}

.cr-label { font-weight: var(--font-weight-6); }

/* FREQ BARS */
.freq-bars {
    display: grid;
    gap: var(--size-3);
}

.freq-bar-wrap {
    display: grid;
    grid-template-columns: 100px 1fr 56px;
    align-items: center;
    gap: var(--size-3);
}

.freq-label {
    font-size: 0.82rem;
    font-weight: var(--font-weight-6);
    color: var(--site-text-muted);
    line-height: 1.3;
}

.freq-label small { font-weight: var(--font-weight-4); opacity: 0.7; }

.freq-track {
    height: 22px;
    background: var(--gray-1);
    border-radius: var(--radius-round);
    overflow: hidden;
    border: 1px solid var(--site-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04) inset;
}

.freq-fill {
    height: 100%;
    border-radius: var(--radius-round);
    transition: width 1s var(--ease-out);
}

.freq-lf { background: linear-gradient(to right, #f97316, #fb923c); }
.freq-hf { background: linear-gradient(to right, #0ea5e9, #38bdf8); }

.freq-pct {
    font-size: 0.88rem;
    font-weight: var(--font-weight-7);
    color: var(--site-text);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.freq-ratio-row {
    display: flex;
    align-items: baseline;
    gap: var(--size-2);
    padding-top: var(--size-2);
    border-top: 1px solid var(--site-border);
    font-size: 0.88rem;
    color: var(--site-text-muted);
}

.freq-ratio-row strong {
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
    color: var(--site-text);
}

.freq-ratio-note {
    font-size: 0.78rem;
    font-style: italic;
}

/* HISTORY TABLE */
.history-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.history-table th {
    text-align: left;
    padding: var(--size-2) var(--size-3);
    border-bottom: 2px solid var(--site-border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--site-text-muted);
    white-space: nowrap;
    font-weight: var(--font-weight-6);
}

.history-table td {
    padding: var(--size-2) var(--size-3);
    border-bottom: 1px solid var(--site-border);
    font-variant-numeric: tabular-nums;
}

.history-table tr:last-child td { border-bottom: none; }
.history-table tr.history-empty td { color: var(--site-text-muted); font-style: italic; text-align: center; }

.hist-flag-normal { color: #059669; }
[data-theme="renew"] .hist-flag-normal { color: #34d399; }

.hist-flag-high   { color: #d97706; }
[data-theme="renew"] .hist-flag-high { color: #fbbf24; }

.hist-flag-low    { color: #dc2626; }
[data-theme="renew"] .hist-flag-low { color: #f87171; }

.hist-flag-artifact { color: var(--site-text-muted); opacity: 0.6; }

.hist-row-new {
    animation: rowfade 1s ease forwards;
}

@keyframes rowfade {
    from { background: rgba(236,72,153,0.1); }
    to   { background: transparent; }
}

[data-theme="renew"] @keyframes rowfade {
    from { background: rgba(245,158,11,0.1); }
    to   { background: transparent; }
}

/* HRV EXPLAINER */
.hrv-explainer {
    padding: clamp(var(--size-5), 3vw, var(--size-7)) clamp(var(--size-5), 3vw, var(--size-7));
    background:
        radial-gradient(ellipse 60% 50% at 50% 20%, var(--accent-a3) 0%, transparent 70%),
        var(--site-panel);
}

.explainer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--size-5);
}

.exp-item {
    display: grid;
    gap: var(--size-3);
    padding: var(--size-3);
    border-radius: var(--radius-3);
    transition: background 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.exp-item:hover {
    background: var(--site-panel);
    box-shadow: var(--shadow-sm);
}

.exp-icon {
    font-size: 1.9rem;
    line-height: 1;
    transition: transform 0.3s var(--ease-out);
}

.exp-item:hover .exp-icon {
    transform: scale(1.1);
}

.exp-item h3 {
    margin: 0;
    font-size: 1.05rem;
}

.exp-item p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--site-text-muted);
    line-height: 1.7;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
    .hrv-shell { grid-template-columns: 300px 1fr; }
}

@media (max-width: 860px) {
    .hrv-shell { grid-template-columns: 1fr; }
    .hrv-hero  { padding: var(--size-6) var(--size-5); }
    .hrv-badges { display: none; }
    .explainer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .metrics-grid { grid-template-columns: 1fr 1fr; }
    .freq-bar-wrap { grid-template-columns: 70px 1fr 44px; }
}