* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: transparent;
    color: #1a1a2e;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 30px 0 20px;
}

.logo {
    max-width: 340px;
    height: auto;
    margin-bottom: 16px;
}

.intro-text {
    font-size: 0.9em;
    color: #555;
    max-width: 600px;
    margin: 8px auto 0;
    line-height: 1.5;
}

header h1 {
    font-size: 2em;
    color: #1a1a2e;
}

.subtitle {
    color: #666;
    margin-top: 8px;
}

/* Field help texts */
.field-help {
    display: block;
    font-size: 0.75em;
    color: #888;
    margin-top: 4px;
    line-height: 1.4;
}

/* Form */
.form-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-section h2 {
    font-size: 1.1em;
    margin-bottom: 16px;
    color: #333;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 180px;
    margin-bottom: 12px;
}

label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.info {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 12px;
}

.hint {
    font-size: 0.8em;
    display: block;
    margin-top: 4px;
    min-height: 1.2em;
}

.hint.success { color: #16a34a; }
.hint.error { color: #dc2626; }

button[type="submit"] {
    display: block;
    width: 100%;
    padding: 14px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 20px;
}

button[type="submit"]:hover { background: #1d4ed8; }
button[type="submit"]:disabled { background: #94a3b8; cursor: not-allowed; }

/* Loading */
.hidden { display: none !important; }

#loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Error */
#error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 16px 24px;
    color: #dc2626;
    margin-bottom: 20px;
}

/* Results */
.result-cards {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.card {
    flex: 1;
    min-width: 200px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h3 {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
}

.card .value {
    font-size: 2.2em;
    font-weight: 700;
    color: #1a1a2e;
}

.card .unit {
    font-size: 0.85em;
    color: #888;
}

.card .desc {
    font-size: 0.8em;
    color: #999;
    margin-top: 8px;
}

.card.highlight {
    background: #2563eb;
    color: #fff;
}

.card.highlight h3, .card.highlight .unit, .card.highlight .desc,
.card.highlight .desc span {
    color: rgba(255,255,255,0.8);
}

.card.highlight .value { color: #fff; }

.card.accent {
    background: #f0fdf4;
    border: 2px solid #16a34a;
}

.card.accent .value { color: #16a34a; }

/* Detail tables */
.detail-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.detail-section h3 {
    font-size: 1em;
    margin-bottom: 12px;
    color: #333;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table td {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

table td:first-child {
    color: #666;
    width: 55%;
}

table td:last-child {
    font-weight: 600;
    text-align: right;
}

/* Bar chart */
.bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.bar-label {
    width: 120px;
    font-size: 0.85em;
    color: #555;
    text-align: right;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    background: #f0f2f5;
    border-radius: 6px;
    height: 24px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
}

.bar-calculated { background: #2563eb; }
.bar-range { background: #60a5fa; }
.bar-estimate { background: #94a3b8; }
.bar-wp { background: #16a34a; }

.bar-value {
    width: 70px;
    font-size: 0.85em;
    font-weight: 600;
    flex-shrink: 0;
}

/* Hinweis */
.hinweis {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 20px 24px;
    margin-top: 16px;
}

.hinweis h3 {
    font-size: 0.95em;
    color: #92400e;
    margin-bottom: 8px;
}

.hinweis ul {
    padding-left: 20px;
}

.hinweis li {
    font-size: 0.85em;
    color: #78350f;
    margin-bottom: 4px;
}

/* Erklärungen */
.ergebnis-erklaerung {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.erklaerung-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.erklaerung-item {
    flex: 1;
    min-width: 200px;
}

.erklaerung-item strong {
    display: block;
    color: #333;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.erklaerung-item p {
    font-size: 0.82em;
    color: #666;
    line-height: 1.5;
}

/* Berechnungsweg */
.berechnungsweg {
    background: #fafbfc;
    border: 1px solid #e2e8f0;
}

.rechenschritt {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef0f3;
}

.rechenschritt:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.rechenschritt h4 {
    font-size: 0.9em;
    color: #2563eb;
    margin-bottom: 8px;
}

.formel {
    font-family: 'Courier New', Courier, monospace;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.85em;
    color: #1a1a2e;
    white-space: pre-wrap;
    line-height: 1.6;
    margin-bottom: 8px;
}

.erklaerung-text {
    font-size: 0.8em;
    color: #666;
    line-height: 1.5;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0 20px;
    margin-top: 30px;
    border-top: 1px solid #ddd;
}

.footer-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 10px;
    opacity: 0.7;
}

footer p {
    font-size: 0.8em;
    color: #999;
}

footer a {
    color: #2563eb;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Toggle / Collapsible sections */
.toggle-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.toggle-header:hover {
    color: #2563eb;
}

.toggle-icon {
    font-size: 0.8em;
    color: #999;
    transition: transform 0.2s;
}

.toggle-content {
    margin-top: 12px;
}

/* Sensitivity table */
.sensitivity-table {
    width: 100%;
    border-collapse: collapse;
}

.sensitivity-table th {
    font-size: 0.85em;
    font-weight: 600;
    color: #555;
    padding: 8px 12px;
    text-align: center;
    border-bottom: 2px solid #e5e7eb;
}

.sensitivity-table td {
    padding: 8px 12px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9em;
    width: auto;
}

.sensitivity-table td:first-child {
    text-align: left;
    width: auto;
    font-weight: normal;
}

.sensitivity-table td:last-child {
    text-align: center;
    font-weight: normal;
}

.sens-sub {
    display: block;
    font-size: 0.8em;
    color: #888;
}

/* Warnungen */
.warn-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 20px;
}

.warn-box p {
    font-size: 0.85em;
    color: #92400e;
    margin-bottom: 4px;
}

.warn-box p:last-child {
    margin-bottom: 0;
}

/* Range slider */
input[type="range"] {
    padding: 0;
    height: 6px;
    border: none;
    border-radius: 3px;
    background: #e5e7eb;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    border: none;
}

input[type="range"]:focus {
    box-shadow: none;
}

/* Canvas */
#temp-chart {
    width: 100%;
    max-width: 700px;
}

/* Responsive */
@media (max-width: 600px) {
    .form-row { flex-direction: column; gap: 0; }
    .form-group { min-width: 100%; }
    .result-cards { flex-direction: column; }
    .card { min-width: 100%; }
    header h1 { font-size: 1.5em; }
    .logo { max-width: 240px; }
    .erklaerung-grid { flex-direction: column; }
}
