* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: sans-serif; background: #f4f4f4; color: #222; padding: 2rem; max-width: 700px; margin: 0 auto; }
h1 { font-size: 1.4rem; font-weight: 500; margin-bottom: 1rem; text-align: center; }
.connection-box { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.25rem; border-radius: 8px; margin-bottom: 1rem; background: #c0392b; color: white; font-weight: 500; }
.connection-box button { background: rgba(255,255,255,0.2); border: none; color: white; padding: 0.4rem 1rem; border-radius: 6px; cursor: pointer; font-size: 13px; }
.connection-box button:hover { background: rgba(255,255,255,0.35); }
.connection-box.connected { background: #1D9E75; }
.tabs { display: flex; gap: 6px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab { padding: 0.5rem 1.25rem; border-radius: 8px; border: 1px solid #ccc; background: #e8e8e4; cursor: pointer; font-size: 14px; font-weight: 500; color: #444; }
.tab:hover { background: #d8d8d4; }
.tab.active { background: #1D9E75; color: white; border-color: #1D9E75; }
.hidden { display: none; }
.canvas-wrap { background: white; border-radius: 12px; border: 1px solid #ccc; padding: 0.5rem; margin-bottom: 1rem; }
canvas#c { display: block; width: 100%; height: 300px; background: white; }
.manual-controls { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.angle-section { background: #e8e8e4; border-radius: 12px; border: 1px solid #ccc; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.angle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.angle-box { background: white; border-radius: 8px; padding: 0.75rem 1rem; text-align: center; border: 1px solid #ccc; }
.angle-box.target { border: 2px solid #E24B4A; }
.angle-label { font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.angle-val { font-size: 1.8rem; font-weight: 500; color: #222; }
.angle-box.target .angle-val { color: #E24B4A; }
.slider-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
input[type="range"] { width: 100%; height: 6px; cursor: pointer; }
.stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.stat { background: #e8e8e4; border-radius: 8px; padding: 1rem 1.5rem; text-align: center; border: 1px solid #ccc; }
.stat.wind { border-color: #378ADD; }
.stat-label { font-size: 13px; color: #666; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-val { font-size: 1.8rem; font-weight: 500; }
.stat-unit { font-size: 12px; color: #888; margin-top: 2px; }
.tare-btn { padding: 0.6rem 1rem; background: #378ADD; color: white; border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 500; cursor: pointer; width: 100%; }
.tare-btn:hover { background: #185FA5; }
.live-chart-wrap { background: white; border-radius: 8px; border: 1px solid #ccc; height: 220px; }
.live-chart-wrap canvas { width: 100% !important; height: 220px !important; }
.sampling-box { background: #e8e8e4; border-radius: 12px; border: 1px solid #ccc; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.sampling-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.sampling-field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.sampling-field label { font-size: 13px; color: #666; }
.sampling-field input { padding: 0.5rem 2rem 0.5rem 0.75rem; border-radius: 6px; border: 1px solid #ccc; font-size: 1.1rem; background: white; width: 100%; }
.unit { position: absolute; right: 10px; bottom: 10px; color: #888; font-size: 14px; }
.run-btn { padding: 0.75rem; background: #1D9E75; color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; }
.run-btn:hover { background: #0F6E56; }
.run-btn:disabled { background: #aaa; cursor: not-allowed; }
.samp-status-box { background: white; border-radius: 8px; border: 1px solid #ccc; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; font-size: 14px; }
.samp-status-row { display: flex; justify-content: space-between; color: #555; }
.samp-status-row span:last-child { font-weight: 500; color: #222; }
.samp-progress-wrap { background: #eee; border-radius: 4px; height: 8px; overflow: hidden; margin-top: 4px; }
.samp-progress-bar { height: 100%; background: #1D9E75; border-radius: 4px; width: 0%; transition: width 0.3s; }
#samp-progress-text { font-size: 13px; color: #888; text-align: center; }
#wsamp-progress-text { font-size: 13px; color: #888; text-align: center; }
.sample-preview { overflow-x: auto; }
.sample-preview table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sample-preview th { text-align: left; padding: 6px 10px; background: #d4d4d0; color: #444; }
.sample-preview td { padding: 6px 10px; border-bottom: 1px solid #ccc; color: #222; }
.charts { display: flex; flex-direction: column; gap: 2rem; }
.charts canvas { width: 100% !important; height: 360px !important; background: white; border-radius: 8px; border: 1px solid #ccc; padding: 0.5rem; }
.download-wrap { display: flex; gap: 10px; align-items: center; }
.download-wrap input { flex: 1; padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid #ccc; font-size: 1rem; background: white; }
.download-btn { padding: 0.75rem 1.5rem; background: #378ADD; color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.download-btn:hover { background: #185FA5; }

/* ── Auto Sampling — sub-tabs (AoA vs Force / Force vs Windspeed) ── */
.subtabs { display: flex; gap: 6px; margin-bottom: 1rem; }
.subtab { padding: 0.4rem 1rem; border-radius: 6px; border: 1px solid #ccc; background: white; cursor: pointer; font-size: 13px; font-weight: 500; color: #444; }
.subtab:hover { background: #d8d8d4; }
.subtab.active { background: #378ADD; color: white; border-color: #378ADD; }

/* ── Wind Sampling sub-tab additions ─────────────────────── */
.wind-sample-hint { font-size: 13px; color: #666; line-height: 1.5; }
.wsample-btn-row { display: flex; gap: 10px; }
.wsample-btn-row .run-btn { flex: 1; }
.abort-btn { flex: 1; padding: 0.75rem; background: #c0392b; color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; }
.abort-btn:hover { background: #96291d; }

.calibration-box { background: #e8e8e4; border-radius: 12px; border: 1px solid #ccc; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.cal-progress { display: flex; align-items: center; justify-content: center; }
.cal-step { width: 32px; height: 32px; border-radius: 50%; background: #ccc; color: white; font-weight: 500; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: background 0.3s; }
.cal-step.active { background: #1D9E75; }
.cal-step.done { background: #0F6E56; }
.cal-line { flex: 1; height: 2px; background: #ccc; max-width: 60px; }
.cal-step-label { text-align: center; font-size: 13px; color: #666; }
.cal-animation-wrap { background: white; border-radius: 10px; border: 1px solid #ccc; height: 160px; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 15px; }
.cal-instruction { font-size: 15px; color: #333; text-align: center; line-height: 1.6; white-space: pre-line; }

.angle-cal-display { background: white; border-radius: 10px; padding: 1.5rem; text-align: center; }
.angle-cal-display .angle-val { font-size: 2.5rem; font-weight: 500; color: #1D9E75; }
.angle-cal-jog-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.jog-btn { padding: 1rem 0.5rem; background: #378ADD; color: white; border: none; border-radius: 8px; font-size: 1.1rem; font-weight: 500; cursor: pointer; }
.jog-btn:hover { background: #185FA5; }
.cal-input-wrap { display: flex; flex-direction: column; gap: 6px; }
.cal-label { font-size: 13px; color: #666; }
.cal-input-row { display: flex; align-items: center; gap: 8px; position: relative; }
.cal-input-row input { padding: 0.6rem 2rem 0.6rem 0.75rem; border-radius: 6px; border: 1px solid #ccc; font-size: 1.2rem; background: white; width: 180px; }
.cal-hint { font-size: 13px; color: #888; min-height: 1.2rem; }
.cal-hint.error { color: #c0392b; }
.cal-btn-row { display: flex; gap: 10px; justify-content: flex-end; }
.cal-back-btn { padding: 0.75rem 1.5rem; background: transparent; border: 1px solid #ccc; border-radius: 8px; font-size: 1rem; cursor: pointer; color: #444; }
.cal-back-btn:hover { background: #d8d8d4; }
.cal-next-btn { padding: 0.75rem 1.5rem; background: #1D9E75; color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; }
.cal-next-btn:hover { background: #0F6E56; }
.cal-result { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1rem 0; }
.cal-result-title { font-size: 1.3rem; font-weight: 500; color: #1D9E75; }
.cal-result-btn-row { display: flex; gap: 10px; width: 100%; }
.cal-result-btn-row .run-btn { flex: 1; }
.cal-result-btn-row .cal-back-btn { flex: 1; }
