* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #f5f6f8; --bg-card: #ffffff; --bg-input: #f0f1f4; --bg-hover: #eaebef;
    --accent: #2563eb; --accent-light: #3b82f6; --accent-bg: #eff4ff; --accent-border: #bfdbfe;
    --warn: #d97706; --warn-bg: #fffbeb; --warn-border: #fde68a;
    --fail: #dc2626; --pass: #16a34a;
    --text: #1e293b; --text-dim: #64748b; --text-muted: #94a3b8;
    --border: #e2e8f0; --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
    --mono: 'JetBrains Mono', monospace; --sans: 'Inter', -apple-system, sans-serif;
}
body { font-family: var(--sans); background: var(--bg); color: var(--text); min-height: 100vh; padding: 20px; font-size: 14px; }
.container { max-width: 1500px; margin: 0 auto; }
h1 { text-align: center; font-size: 1.75em; font-weight: 700; margin-bottom: 4px; }
.subtitle { text-align: center; color: var(--text-dim); font-size: 0.88em; margin-bottom: 20px; }
.tab-nav { display: flex; background: var(--bg-card); border-radius: var(--radius) var(--radius) 0 0; border: 1px solid var(--border); border-bottom: none; overflow-x: auto; box-shadow: var(--shadow); }
.tab-button { flex: 1; padding: 12px 14px; background: transparent; color: var(--text-dim); border: none; cursor: pointer; font-size: 0.88em; font-weight: 600; font-family: var(--sans); transition: all 0.15s; white-space: nowrap; border-right: 1px solid var(--border); position: relative; }
.tab-button:last-child { border-right: none; }
.tab-button:hover { color: var(--text); background: var(--bg); }
.tab-button.active { color: var(--accent); background: var(--bg); }
.tab-button.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--accent); }
.tab-content { background: var(--bg); padding: 24px; border-radius: 0 0 var(--radius) var(--radius); border: 1px solid var(--border); border-top: none; min-height: 500px; }
.tab-pane { display: none; } .tab-pane.active { display: block; }
.section-title { color: var(--text); margin-bottom: 20px; font-size: 1.35em; font-weight: 700; text-align: center; }
.calculator-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.calc-card { background: var(--bg-card); border-radius: var(--radius); padding: 22px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.calc-card:hover { box-shadow: var(--shadow-md); }
.calc-card h2 { color: var(--accent); margin-bottom: 4px; font-size: 1.05em; font-weight: 700; }
.card-desc { color: var(--text-dim); font-size: 0.82em; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); line-height: 1.5; }
.formula-box { margin-bottom: 16px; padding: 10px 14px; background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: 6px; font-family: var(--mono); font-size: 0.8em; color: var(--text); line-height: 1.7; }
.formula-box .f-label { font-family: var(--sans); font-weight: 600; color: var(--accent); font-size: 0.85em; margin-bottom: 4px; }
.formula-box .f-note { font-family: var(--sans); color: var(--text-dim); font-size: 0.92em; font-style: italic; margin-top: 4px; }
.formula-box code { background: rgba(37,99,235,0.08); padding: 1px 5px; border-radius: 3px; font-weight: 500; }
.input-group { margin-bottom: 12px; }
label { display: block; margin-bottom: 4px; color: var(--text-dim); font-weight: 500; font-size: 0.84em; }
input[type="number"] { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.92em; font-family: var(--mono); background: var(--bg-input); color: var(--text); transition: border-color 0.15s; }
input[type="number"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
button { width: 100%; padding: 9px; background: var(--accent); color: white; border: none; border-radius: 6px; font-size: 0.88em; font-weight: 600; font-family: var(--sans); cursor: pointer; transition: all 0.12s; margin-top: 6px; }
button:hover { background: var(--accent-light); } button:active { transform: scale(0.98); }
button.btn-secondary { background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--border); }
button.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }
.result { margin-top: 14px; padding: 12px 14px; background: var(--bg-input); border-radius: 6px; border-left: 3px solid var(--accent); min-height: 44px; font-family: var(--mono); font-size: 0.84em; line-height: 1.7; }
.result h3 { color: var(--accent); margin-bottom: 6px; font-family: var(--sans); font-size: 0.9em; }
.result p { color: var(--text-dim); margin: 2px 0; }
.result .value { font-weight: 600; color: var(--text); }
.result .pass { color: var(--pass); font-weight: 700; }
.result .fail { color: var(--fail); font-weight: 700; }
.result .warn { color: var(--warn); font-weight: 600; }
.result hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }
.complex-input { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode-toggle { display: flex; gap: 4px; margin-bottom: 12px; }
.mode-toggle button { flex: 1; padding: 6px 4px; margin-top: 0; font-size: 0.8em; background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--border); border-radius: 5px; }
.mode-toggle button.active { background: var(--accent); color: white; border-color: var(--accent); }
.mode-toggle button:hover:not(.active) { background: var(--bg-hover); color: var(--text); }
@media (max-width: 900px) { .tab-nav { flex-wrap: wrap; } .tab-button { flex: 1 0 50%; } .calculator-grid { grid-template-columns: 1fr; } .tab-content { padding: 14px; } }

/* ── L-Network schematic container ────────────────────────────────────────── */
.schematic-wrap {
    background: #f8faff;
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    padding: 12px 6px 10px;
    margin-top: 14px;
    overflow: hidden;
}
.schematic-wrap svg {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}
.schematic-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: .75em;
    color: var(--text-dim);
    font-family: var(--sans);
}
.schematic-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
}
.schematic-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}