/* Generador de diagramas de Bode (se carga solo en /diagrama-de-bode/) */
:root { --bd-real: var(--accent); --bd-asym: #ea580c; --bd-grid: #e9ebf2; --bd-grid2: #f2f3f8; --bd-zero: #16a34a; --bd-pole: #dc2626; }
@media (prefers-color-scheme: dark) {
  :root { --bd-asym: #fb923c; --bd-grid: #262b42; --bd-grid2: #1d2135; --bd-zero: #4ade80; --bd-pole: #f87171; }
}

.bd-tf { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bd-tf .bd-h { font: 700 1.35rem Georgia, "Times New Roman", serif; white-space: nowrap; }
.bd-frac { display: flex; flex-direction: column; gap: 6px; flex: 1 1 300px; min-width: 0; }
.bd-frac .bd-bar { height: 2px; background: var(--text); border-radius: 2px; }
.bd-frac input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.08rem; text-align: center; }
.bd-ex { display: flex; flex-wrap: wrap; gap: 6px; }
.bd-ex button {
  font: inherit; font-size: .84rem; padding: 4px 11px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.bd-ex button:hover { border-color: var(--accent); color: var(--accent); }

.bd-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .86rem; color: var(--muted); margin: 0 0 6px; }
.bd-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bd-legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--bd-real); }
.bd-legend i.asym { border-top: 3px dashed var(--bd-asym); }
.bd-legend i.fac { border-top-width: 2px; border-top-style: dashed; }
.bd-chart { position: relative; touch-action: pan-y; }
.bd-chart + .bd-chart { margin-top: 4px; }
.bd-chart svg { display: block; width: 100%; height: auto; user-select: none; -webkit-tap-highlight-color: transparent; }
.bd-chart .grid { stroke: var(--bd-grid); stroke-width: 1; }
.bd-chart .grid2 { stroke: var(--bd-grid2); stroke-width: 1; }
.bd-chart .zero-line { stroke: var(--muted); stroke-width: 1; opacity: .55; }
.bd-chart .frame { fill: none; stroke: var(--border); }
.bd-chart .tick { font: 11px system-ui, sans-serif; fill: var(--muted); }
.bd-chart .axis-t { font: 600 12px system-ui, sans-serif; fill: var(--text); }
.bd-chart .real { fill: none; stroke: var(--bd-real); stroke-width: 2.6; stroke-linejoin: round; }
.bd-chart .asym { fill: none; stroke: var(--bd-asym); stroke-width: 2; stroke-dasharray: 7 5; stroke-linejoin: round; }
.bd-chart .fac { fill: none; stroke-width: 1.6; stroke-dasharray: 3 3; opacity: .9; }
.bd-chart .brk { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; opacity: .7; }
.bd-chart .brk-t { font: 600 10.5px system-ui, sans-serif; fill: var(--muted); text-anchor: middle; }
.bd-chart .cur { stroke: var(--text); stroke-width: 1; opacity: .5; }
.bd-chart .dot { stroke: var(--panel); stroke-width: 2; }
.bd-chart .mk { font: 700 10.5px system-ui, sans-serif; text-anchor: middle; }
.bd-read { min-height: 1.6em; font-size: .92rem; color: var(--muted); text-align: center; margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.bd-read b { color: var(--text); }
.bd-opts .seg { align-self: flex-start; }
.bd-opts { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin-top: 12px; }

.bd-form { font: 600 1.12rem Georgia, "Times New Roman", serif; overflow-x: auto; padding: 4px 0 8px; }
.bd-form .bd-fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .2em; }
.bd-form .bd-fr > span { padding: 0 .3em; white-space: nowrap; }
.bd-form .bd-fr > span:first-child { border-bottom: 1.5px solid currentColor; }
.bd-form .lbl { font: 600 .78rem system-ui, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 2px; }
.bd-pz { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 16px; align-items: start; margin-top: 10px; }
@media (max-width: 760px) { .bd-pz { grid-template-columns: minmax(0, 1fr); } }
.bd-splane svg { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
.bd-splane .ax { stroke: var(--muted); stroke-width: 1; }
.bd-splane .rhp { fill: var(--bd-pole); opacity: .06; }
.bd-splane .z { fill: none; stroke: var(--bd-zero); stroke-width: 2.4; }
.bd-splane .p { stroke: var(--bd-pole); stroke-width: 2.6; stroke-linecap: round; }
.bd-splane text { font: 11px system-ui, sans-serif; fill: var(--muted); }
.bd-zc { color: var(--bd-zero); font-weight: 700; }
.bd-pc { color: var(--bd-pole); font-weight: 700; }
.bd-table td, .bd-table th { text-align: center; }
.bd-table td:first-child { font-family: inherit !important; font-weight: 600 !important; }
.bd-table td.l { text-align: left; }
.bd-warn { border-left: 4px solid var(--cell-x); background: var(--bg); padding: 8px 12px; border-radius: 8px; margin: 10px 0 0; font-size: .93rem; }
.bd-swatch { display: inline-block; width: 14px; height: 0; border-top: 3px dashed; vertical-align: middle; margin-right: 4px; }
