/* Imported from fitdata_compare/style.css. Original used a dark "lab"
       theme; preserved here as a designed contrast inside our brand chrome
       (the FIT-compare panel reads as a power-tool dashboard, similar in
       spirit to a GPU monitor or DAW interface). All selectors scoped
       under .fitcompare-host so nothing leaks. */
    .fitcompare-host {
      background: #020617;
      color: #e5e7eb;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      line-height: 1.5;
      border-radius: 14px;
      padding: 8px;
      box-shadow: 0 18px 40px rgba(2, 6, 23, 0.18);
    }
    .fitcompare-host *, .fitcompare-host *::before, .fitcompare-host *::after { box-sizing: border-box; }
    .fitcompare-host h1, .fitcompare-host h2, .fitcompare-host h3, .fitcompare-host h4, .fitcompare-host h5, .fitcompare-host p, .fitcompare-host ul { margin: 0; padding: 0; }

    .fitcompare-host .fc-wrapper { max-width: 1140px; margin: 0 auto; padding: 16px 16px 32px; }

    /* Page header */
    .fitcompare-host .page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid rgba(148,163,184,0.15); }
    .fitcompare-host .page-header h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: #f8fafc; }
    .fitcompare-host .subtitle { margin-top: 4px; font-size: 0.88rem; color: #9ca3af; max-width: 620px; }
    .fitcompare-host .brand { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: #9ca3af; white-space: nowrap; }
    .fitcompare-host .brand-dot { width: 10px; height: 10px; border-radius: 999px; background: linear-gradient(135deg, #FA773C, #9966FF); }

    /* Cards */
    .fitcompare-host .card { background: #0f172a; border-radius: 12px; border: 1px solid rgba(148,163,184,0.18); padding: 18px 20px; margin-bottom: 16px; }
    .fitcompare-host .section-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; color: #f8fafc; }
    .fitcompare-host .subsection-title { font-size: 0.92rem; font-weight: 600; margin: 18px 0 8px; color: #cbd5e1; }
    .fitcompare-host .hint { font-size: 0.82rem; color: #64748b; margin-bottom: 10px; }
    .fitcompare-host .global-hint { margin-top: 10px; font-size: 0.78rem; color: #475569; }

    /* Upload inputs */
    .fitcompare-host .inputs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 20px; margin-bottom: 14px; }
    .fitcompare-host .input-block label { display: block; font-size: 0.82rem; color: #94a3b8; margin-bottom: 3px; }
    .fitcompare-host .input-block .file-label { margin-top: 8px; }
    .fitcompare-host .input-block input[type="text"] { width: 100%; background: #1e293b; border: 1px solid rgba(148,163,184,0.25); border-radius: 6px; padding: 6px 10px; color: #e5e7eb; font-size: 0.85rem; }
    .fitcompare-host .input-block input[type="text"]::placeholder { color: #475569; }
    .fitcompare-host .input-block input[type="file"] { width: 100%; font-size: 0.82rem; color: #94a3b8; }
    .fitcompare-host .input-block input[type="file"]::file-selector-button { background: #1e293b; border: 1px solid rgba(148,163,184,0.3); border-radius: 6px; color: #e5e7eb; padding: 4px 12px; cursor: pointer; font-size: 0.8rem; margin-right: 8px; }
    .fitcompare-host .input-block input[type="file"]::file-selector-button:hover { background: #334155; }

    .fitcompare-host .file-size { display: inline-block; font-size: 0.75rem; color: #64748b; margin-left: 4px; font-variant-numeric: tabular-nums; }

    /* Buttons */
    .fitcompare-host .actions-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
    .fitcompare-host .btn-primary { background: linear-gradient(135deg, #FA773C, #9966FF); color: #fff; border: none; border-radius: 8px; padding: 9px 22px; font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: filter 0.15s; letter-spacing: 0.04em; text-transform: uppercase; }
    .fitcompare-host .btn-primary:hover { filter: brightness(1.08); }
    .fitcompare-host .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
    .fitcompare-host .btn-secondary { background: transparent; border: 1px solid rgba(148,163,184,0.4); border-radius: 8px; color: #cbd5e1; padding: 7px 16px; font-size: 0.84rem; cursor: pointer; transition: background 0.15s; }
    .fitcompare-host .btn-secondary:hover { background: rgba(30,41,59,0.8); border-color: #FA773C; color: #FA773C; }
    .fitcompare-host .btn-small { padding: 4px 12px; font-size: 0.78rem; }
    .fitcompare-host .error { color: #f87171; font-size: 0.82rem; }

    /* Spinner */
    .fitcompare-host .spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: fc-spin 0.6s linear infinite; vertical-align: middle; margin-right: 6px; }
    @keyframes fc-spin { to { transform: rotate(360deg); } }

    /* Controls bar */
    .fitcompare-host .controls-bar { padding: 12px 20px; position: sticky; top: 0; z-index: 20; background: #0f172a; border-bottom: 1px solid rgba(148,163,184,0.25); }
    .fitcompare-host .controls-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
    .fitcompare-host .control-group { display: flex; align-items: center; gap: 6px; }
    .fitcompare-host .control-group label { font-size: 0.82rem; color: #94a3b8; }
    .fitcompare-host .control-group select { background: #1e293b; border: 1px solid rgba(148,163,184,0.3); border-radius: 6px; color: #e5e7eb; padding: 4px 8px; font-size: 0.82rem; cursor: pointer; }

    /* Alignment controls */
    .fitcompare-host .align-info { font-size: 0.85rem; color: #94a3b8; margin-bottom: 12px; font-weight: 500; }
    .fitcompare-host .offset-controls { display: flex; flex-direction: column; gap: 10px; }
    .fitcompare-host .offset-row { display: flex; align-items: center; gap: 12px; }
    .fitcompare-host .offset-row label { font-size: 0.84rem; color: #94a3b8; min-width: 130px; }
    .fitcompare-host .offset-row input[type="range"] { flex: 1; max-width: 300px; accent-color: #FA773C; }
    .fitcompare-host .offset-value { font-size: 0.85rem; font-weight: 600; color: #e5e7eb; min-width: 45px; text-align: right; font-variant-numeric: tabular-nums; }
    .fitcompare-host .offset-actions { display: flex; gap: 10px; margin-top: 4px; }

    /* Device sources */
    .fitcompare-host .device-sources { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
    .fitcompare-host .device-col { background: #1e293b; border-radius: 10px; padding: 12px 14px; }
    .fitcompare-host .device-col h3 { font-size: 0.9rem; margin-bottom: 6px; font-weight: 600; color: #e5e7eb; }
    .fitcompare-host .device-info { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
    .fitcompare-host .device-tag { font-size: 0.75rem; padding: 2px 8px; border-radius: 4px; background: rgba(148,163,184,0.1); color: #94a3b8; }
    .fitcompare-host .device-empty { font-size: 0.82rem; color: #475569; }
    .fitcompare-host .device-metric-list { list-style: none; font-size: 0.82rem; }
    .fitcompare-host .device-metric-list li { padding: 1px 0; }
    .fitcompare-host .metric-ok { color: #22c55e; font-weight: 500; }
    .fitcompare-host .metric-missing { color: #475569; }

    /* Diagnosis panel */
    .fitcompare-host .diagnosis-panel { display: flex; flex-direction: column; gap: 6px; }
    .fitcompare-host .diag-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; font-size: 0.84rem; border-left: 3px solid; }
    .fitcompare-host .diag-icon { font-size: 1rem; min-width: 18px; text-align: center; }
    .fitcompare-host .diag-ok { background: rgba(34,197,94,0.08); border-left-color: #22c55e; color: #86efac; }
    .fitcompare-host .diag-low { background: rgba(234,179,8,0.06); border-left-color: #eab308; color: #fde047; }
    .fitcompare-host .diag-moderate { background: rgba(249,115,22,0.08); border-left-color: #f97316; color: #fdba74; }
    .fitcompare-host .diag-high { background: rgba(239,68,68,0.08); border-left-color: #ef4444; color: #fca5a5; }

    /* Charts */
    .fitcompare-host .chart-card { padding-bottom: 12px; }
    .fitcompare-host .chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
    .fitcompare-host .chart-header h2 { font-size: 1rem; font-weight: 600; color: #f8fafc; }
    .fitcompare-host .chart-hint { font-size: 0.75rem; color: #64748b; margin-bottom: 6px; }
    .fitcompare-host .chart-label-hint { font-size: 0.72rem; color: #475569; font-style: italic; }
    .fitcompare-host .chart-wrap { position: relative; height: 260px; }
    .fitcompare-host .chart-wrap canvas { width: 100% !important; height: 100% !important; }

    /* Zoom overlay */
    .fitcompare-host .zoom-overlay { position: absolute; background: rgba(250,119,60,0.15); border-left: 1px solid rgba(250,119,60,0.5); border-right: 1px solid rgba(250,119,60,0.5); pointer-events: none; z-index: 5; }

    /* GPS Map */
    .fitcompare-host #routeMap { width: 100%; height: 340px; border-radius: 8px; overflow: hidden; }
    .fitcompare-host .leaflet-container { font-size: 0.8rem; }

    /* Summary tables */
    .fitcompare-host .summary-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-top: 6px; }
    .fitcompare-host .summary-table th, .fitcompare-host .summary-table td { border: 1px solid rgba(51,65,85,0.7); padding: 5px 8px; text-align: center; }
    .fitcompare-host .summary-table th { background: #1e293b; color: #94a3b8; font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
    .fitcompare-host .summary-table td { color: #cbd5e1; }
    .fitcompare-host .summary-table tbody tr:hover { background: rgba(30,41,59,0.5); }

    /* Device badges */
    .fitcompare-host .device-badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
    .fitcompare-host .device-badge-A { background: rgba(34,197,94,0.15); color: #22c55e; }
    .fitcompare-host .device-badge-B { background: rgba(59,130,246,0.15); color: #3b82f6; }
    .fitcompare-host .device-badge-C { background: rgba(245,158,11,0.15); color: #f59e0b; }

    /* Responsive */
    @media (max-width: 900px) {
      .fitcompare-host .inputs-grid,
      .fitcompare-host .device-sources { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    }
    @media (max-width: 640px) {
      .fitcompare-host .page-header { flex-direction: column; align-items: flex-start; }
      .fitcompare-host .chart-wrap { height: 220px; }
      .fitcompare-host .offset-row { flex-wrap: wrap; }
      .fitcompare-host .offset-row input[type="range"] { max-width: 100%; }
    }