/* Tabs (variable a calcular) */
.tipo-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tipo-tab {
    flex: 1 1 auto;
    min-width: 140px;
    padding: 10px 14px;
    border: 2px solid var(--color-border, #d1d5db);
    border-radius: 8px;
    background: var(--color-surface, #fff);
    color: var(--color-text, #374151);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}

.tipo-tab:hover {
    border-color: var(--color-primary, #2563eb);
    color: var(--color-primary, #2563eb);
}

.tipo-tab.active {
    background: var(--color-primary, #2563eb);
    border-color: var(--color-primary, #2563eb);
    color: #fff;
}

/* Form grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.field-full {
    grid-column: 1 / -1;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-secondary, #4b5563);
}

.input-wrapper {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--color-border, #d1d5db);
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-surface, #fff);
    transition: border-color .2s;
}

.input-wrapper:focus-within {
    border-color: var(--color-primary, #2563eb);
}

.input-wrapper input,
.input-wrapper select {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 12px;
    font-size: 1rem;
    font-family: inherit;
    background: transparent;
    color: var(--color-text, #374151);
}

.input-suffix {
    padding: 0 12px;
    font-size: 0.85rem;
    color: var(--color-text-muted, #9ca3af);
    white-space: nowrap;
}

.field-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted, #9ca3af);
}

/* Superficie presets */
.surface-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.surface-btn {
    padding: 8px 10px;
    border: 2px solid var(--color-border, #d1d5db);
    border-radius: 8px;
    background: var(--color-surface, #fff);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all .2s;
    color: var(--color-text, #374151);
}

.surface-btn:hover {
    border-color: var(--color-primary, #2563eb);
}

.surface-btn.active {
    background: var(--color-primary, #2563eb);
    border-color: var(--color-primary, #2563eb);
    color: #fff;
}

.surface-btn small {
    display: block;
    font-weight: 400;
    opacity: .8;
    font-size: 0.72rem;
}

/* Calculate button */
.btn-calc {
    margin-top: 8px;
    width: 100%;
    padding: 14px;
    background: var(--color-primary, #2563eb);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s, transform .1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-calc:hover {
    background: #1d4ed8;
}

.btn-calc:active {
    transform: scale(.98);
}

/* Speed risk indicator */
.speed-risk {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    display: none;
}

.speed-risk.visible {
    display: block;
}

.speed-risk.ok {
    background: #dcfce7;
    color: #15803d;
    border-left: 4px solid #16a34a;
}

.speed-risk.warn {
    background: #fef9c3;
    color: #92400e;
    border-left: 4px solid #d97706;
}

.speed-risk.danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

/* Formula used */
.formula-used {
    margin-top: 12px;
    padding: 12px 16px;
    background: color-mix(in srgb, var(--color-primary, #2563eb) 5%, transparent);
    border-left: 4px solid var(--color-primary, #2563eb);
    border-radius: 6px;
    font-size: 0.88rem;
    color: var(--color-text, #374151);
    display: none;
}

.formula-used.visible {
    display: block;
}

.formula-used code {
    font-weight: 700;
}

/* Chart */
.chart-section {
    display: none;
}

.chart-section.visible {
    display: block;
}

.bar-chart-wrap {
    width: 100%;
    overflow-x: auto;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--color-text-secondary, #4b5563);
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
}

/* SVG axes */
.axis-label {
    font-size: 11px;
    fill: var(--color-text-secondary, #6b7280);
}

.grid-line {
    stroke: var(--color-border, #e5e7eb);
    stroke-dasharray: 4 3;
}

/* Table */
.table-section {
    display: none;
}

.table-section.visible {
    display: block;
}

.table-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.btn-toggle-table {
    padding: 6px 14px;
    border: 1.5px solid var(--color-border, #d1d5db);
    border-radius: 6px;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    color: var(--color-text, #374151);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
}

.btn-toggle-table:hover {
    border-color: var(--color-primary, #2563eb);
    color: var(--color-primary, #2563eb);
}

.table-wrapper {
    overflow-x: auto;
}

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table-wrapper th,
.table-wrapper td {
    padding: 8px 12px;
    border: 1px solid var(--color-border, #e5e7eb);
    text-align: right;
}

.table-wrapper th {
    background: var(--color-surface-alt, #f3f4f6);
    font-weight: 700;
    text-align: center;
}

.table-wrapper tr:nth-child(even) td {
    background: color-mix(in srgb, var(--color-primary, #2563eb) 3%, transparent);
}

/* SEO block */
.seo-block h2,
.seo-block h3 {
    margin-top: 1.4em;
}

.formula-box {
    background: var(--color-surface-alt, #2563eb);
    border-radius: 6px;
    padding: 10px 16px;
    font-family: monospace;
    font-size: 1rem;
    margin: 8px 0;
}

.formula-legend {
    list-style: none;
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
}

.formula-legend li {
    color: var(--color-text-secondary, #4b5563);
}