:root {
    --primary: #2563eb; --danger: #dc2626; --success: #16a34a;
    --warning: #d97706; --purple: #7c3aed; --bg: #f1f5f9;
    --card-bg: #ffffff; --text-main: #0f172a; --text-muted: #64748b;
    --border: #e2e8f0; --section-bg: #f8fafc;
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: var(--bg); color: var(--text-main); margin: 0; padding: 10px; display: flex; justify-content: center; -webkit-font-smoothing: antialiased;}
.dashboard { background-color: var(--card-bg); max-width: 1100px; width: 100%; border-radius: 12px; box-shadow: 0 8px 20px -5px rgba(0,0,0,0.1); padding: 20px; box-sizing: border-box; }
.header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 15px; flex-wrap: wrap; gap: 15px;}
.header-title h1 { margin: 0 0 5px 0; font-size: 24px; color: #0f172a; letter-spacing: -0.5px;}
.header-title p { margin: 0; color: var(--text-muted); font-size: 14px; font-weight: 500;}
.badge { background: #fee2e2; color: #991b1b; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; vertical-align: middle; margin-left: 10px; border: 1px solid #fca5a5;}
.header-controls { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; width: 100%;}
@media (min-width: 600px) { .header-controls { width: auto; } }
.manifest-inputs { display: flex; gap: 10px; background: #f8fafc; padding: 8px 12px; border-radius: 6px; border: 1px solid #cbd5e1; width: 100%; box-sizing: border-box; justify-content: space-between;}
.manifest-group { display: flex; flex-direction: column; flex: 1;}
.manifest-group label { font-size: 10px; text-transform: uppercase; color: #64748b; font-weight: bold; margin-bottom: 2px; }
.manifest-group input { border: none; border-bottom: 1px solid #94a3b8; background: transparent; font-size: 16px; font-weight: bold; color: #0f172a; width: 100%; padding: 4px 2px; outline: none; border-radius: 0;}
.manifest-group input:focus { border-bottom-color: var(--primary); }
.btn-action { background: #0f172a; color: white; border: none; padding: 12px 20px; border-radius: 6px; font-weight: bold; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; transition: background 0.2s;}
.btn-action:hover { background: #334155; }
@media (min-width: 600px) { .btn-action { width: auto; } }
.btn-gps { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; padding: 8px 12px; border-radius: 6px; font-weight: bold; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-bottom: 15px; transition: 0.2s;}
.btn-gps:hover { background: #dbeafe; }
.top-row { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.controls { flex: 5; min-width: 300px; display: flex; flex-direction: column; gap: 15px; }
.settings-block { background: #ffffff; border: 1px solid var(--border); border-radius: 8px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);}
.block-title { font-size: 14px; font-weight: 800; color: #1e293b; margin: 0 0 15px 0; text-transform: uppercase; border-bottom: 2px solid #e2e8f0; padding-bottom: 5px;}
.control-group { margin-bottom: 12px; }
.control-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.control-header label { font-weight: 700; font-size: 13px; color: #475569;}
.number-input { width: 75px; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-weight: bold; color: var(--primary); text-align: right; font-size: 16px;}
select.number-input { width: auto; font-size: 14px; padding: 6px; }
input[type="range"] { width: 100%; cursor: pointer; accent-color: var(--primary); margin: 10px 0;}
.switch-container { display: flex; justify-content: space-between; align-items: center; background: #eff6ff; padding: 10px 12px; border-radius: 8px; border: 1px solid #bfdbfe;}
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0;}
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .3s; border-radius: 26px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2);}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }
.sequence-block { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 12px; margin-top: 15px;}
.sequence-block label { color: #c2410c; font-weight: 800;}
details { margin-top: 15px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; overflow: hidden; }
summary { font-size: 13px; font-weight: bold; color: #166534; padding: 12px; cursor: pointer; user-select: none; background: #dcfce7;}
.details-content { padding: 12px; font-size: 13px; color: #14532d; line-height: 1.5; border-top: 1px solid #bbf7d0;}
.details-content ul { margin: 5px 0; padding-left: 20px; }
.results { flex: 4; min-width: 300px; display: flex; flex-direction: column; gap: 12px; }
.result-card { padding: 15px; border-radius: 8px; border-left: 5px solid; background: #ffffff; border: 1px solid var(--border); border-left-width: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);}
.result-title { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 800; margin-bottom: 3px; letter-spacing: 0.5px;}
.result-value { font-size: 28px; font-weight: 900; margin: 0; display: flex; align-items: baseline; gap: 5px; }
.result-unit { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.warning-box { padding: 12px 15px; border-radius: 8px; font-size: 13px; font-weight: bold; display: none; line-height: 1.4; border-left: 5px solid;}
.warn-danger { background: #fef2f2; border: 1px solid #fca5a5; border-left-color: #ef4444; color: #991b1b; display: block;}
.warn-success { background: #ecfdf5; border: 1px solid #86efac; border-left-color: #10b981; color: #065f46; display: block;}
.warn-warning { background: #fffbeb; border: 1px solid #fcd34d; border-left-color: #f59e0b; color: #92400e; display: block;}
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 10px;}
@media (max-width: 800px) { .charts-grid { grid-template-columns: 1fr; } }
.chart-box { border: 1px solid var(--border); border-radius: 8px; padding: 15px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow: hidden;}
.chart-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.chart-header h3 { margin: 0; font-size: 15px; color: #1e293b; font-weight: 800;}
.leg-color { width: 12px; height: 12px; border-radius: 2px; }
canvas { width: 100%; height: 220px; display: block; }
.print-only { display: none; }

/* СТИЛІ ДЛЯ ДРУКУ / PDF */
@media print {
    body { background: white; padding: 0; margin: 0; }
    .dashboard { box-shadow: none; border: none; padding: 0; max-width: 100%; }
    .header, details, input[type="range"], .slider, .switch-container, .btn-gps, .btn-action { display: none !important; }
    .print-only { display: block; }
    .number-input, select.number-input { border: none; padding: 0; text-align: left; background: transparent; color: black; font-size: 14px; -webkit-appearance: none;}
    .settings-block { border: 1px solid #000; break-inside: avoid; margin-bottom: 10px; padding: 10px; box-shadow: none;}
    .sequence-block { border: 1px solid #000; background: transparent; }
    .result-card { border: 1px solid #000; break-inside: avoid; box-shadow: none;}
    .print-header { display: block; text-align: center; margin-bottom: 20px; border-bottom: 2px solid #000; padding-bottom: 10px; }
    .print-header h1 { margin: 0; font-size: 20px; text-transform: uppercase;}
    .print-header p { margin: 5px 0 0 0; font-size: 12px; }
    .print-meta { display: flex; justify-content: space-between; margin-top: 15px; font-weight: bold; font-size: 14px; padding: 0 10px;}
    .top-row { display: block; }
    .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px;}
    .results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .charts-grid { display: block; }
    .chart-box { break-inside: avoid; margin-bottom: 15px; border: 1px solid #000; box-shadow: none;}
    
    /* СТИЛІ ДЛЯ ІНЖЕНЕРНОГО ЛОГУ (МАТЕМАТИКА) */
    .print-log { page-break-before: always; font-family: monospace; font-size: 12px; background: #f8fafc; padding: 20px; border: 1px solid #000; }
    .print-log h2 { border-bottom: 1px dashed #000; padding-bottom: 5px; margin-top: 0;}
    .log-row { display: flex; justify-content: space-between; border-bottom: 1px dotted #ccc; padding: 4px 0;}
    .log-header { font-weight: bold; margin-top: 15px; background: #e2e8f0; padding: 4px; }
    
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}