/* Calculadoras RD — estilos de calculadoras, tarjetas y formularios */
:root {
	--crd-blue: #002d62;
	--crd-blue-2: #0a4a9c;
	--crd-red: #ce1126;
	--crd-ink: #0f1b2d;
	--crd-muted: #5a6577;
	--crd-line: #dfe4ec;
	--crd-soft: #f4f6fa;
	--crd-bg: #ffffff;
	--crd-ok: #0b7a3e;
	--crd-radius: 14px;
}

.crd-lead { font-size: 1.125rem; color: var(--crd-muted); }

/* Contenedor de la calculadora */
.crd-calc {
	background: var(--crd-bg);
	border: 1px solid var(--crd-line);
	border-top: 5px solid var(--crd-blue);
	border-radius: var(--crd-radius);
	box-shadow: 0 10px 30px -18px rgba(0, 45, 98, .35);
	padding: clamp(18px, 3vw, 32px);
	margin: 28px 0 36px;
}
.crd-cat-impuestos.crd-calc { border-top-color: var(--crd-red); }
.crd-calc-head { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.crd-calc-icon {
	flex: 0 0 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
	background: var(--crd-blue); color: #fff;
}
.crd-cat-impuestos .crd-calc-icon { background: var(--crd-red); }
.crd-calc-title { margin: 0 !important; font-size: 1.35rem; line-height: 1.25; color: var(--crd-ink); }
.crd-calc-meta { margin: 2px 0 0 !important; font-size: .85rem; color: var(--crd-muted); }

/* Campos */
.crd-form { display: grid; gap: 16px; }
.crd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.crd-field { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; }
.crd-field > label, .crd-radios legend { font-weight: 600; font-size: .95rem; color: var(--crd-ink); padding: 0; }
.crd-field small { color: var(--crd-muted); font-size: .82rem; line-height: 1.4; }
.crd-field input[type="text"], .crd-field input[type="email"], .crd-field input[type="number"],
.crd-field input[type="date"], .crd-field select, .crd-field textarea {
	width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; color: var(--crd-ink);
	background: #fff; border: 1.5px solid var(--crd-line); border-radius: 10px; padding: 11px 12px;
	min-height: 46px; transition: border-color .15s, box-shadow .15s;
}
.crd-field input:focus, .crd-field select:focus, .crd-field textarea:focus {
	outline: none; border-color: var(--crd-blue-2); box-shadow: 0 0 0 3px rgba(10, 74, 156, .15);
}
.crd-input-pre, .crd-input-suf { display: flex; align-items: stretch; }
.crd-input-pre span, .crd-input-suf span {
	display: grid; place-items: center; padding: 0 12px; background: var(--crd-soft);
	border: 1.5px solid var(--crd-line); color: var(--crd-muted); font-weight: 600; font-size: .9rem;
}
.crd-input-pre span { border-right: 0; border-radius: 10px 0 0 10px; }
.crd-input-pre input { border-radius: 0 10px 10px 0 !important; }
.crd-input-suf span { border-left: 0; border-radius: 0 10px 10px 0; }
.crd-input-suf input { border-radius: 10px 0 0 10px !important; }
.crd-input-suf input:only-child { border-radius: 10px !important; }

.crd-radios { border: 0; padding: 0; margin: 0; }
.crd-seg { display: inline-flex; flex-wrap: wrap; background: var(--crd-soft); border-radius: 10px; padding: 4px; gap: 4px; }
.crd-seg input { position: absolute; opacity: 0; pointer-events: none; }
.crd-seg label { padding: 9px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--crd-muted); }
.crd-seg input:checked + label { background: #fff; color: var(--crd-blue); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.crd-seg input:focus-visible + label { outline: 2px solid var(--crd-blue-2); }

.crd-check { flex-direction: row; align-items: center; gap: 10px; }
.crd-check input { width: 20px; height: 20px; accent-color: var(--crd-blue); }
.crd-check label { font-weight: 500; }
[hidden] { display: none !important; }

/* Opciones avanzadas plegables */
.crd-more { border: 1px dashed var(--crd-line); border-radius: 10px; padding: 0 14px; }
.crd-more summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--crd-blue); }
.crd-more[open] { padding-bottom: 14px; }

/* Divisas */
.crd-rates { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.crd-rate { background: var(--crd-soft); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; border-left: 4px solid var(--crd-blue); }
.crd-rate:nth-child(2) { border-left-color: var(--crd-red); }
.crd-rate span { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--crd-muted); }
.crd-rate strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; color: var(--crd-ink); }
.crd-rate small { color: var(--crd-muted); font-size: .8rem; }
.crd-fx { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.crd-swap { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--crd-line); background: #fff; color: var(--crd-blue); font-size: 1.3rem; cursor: pointer; }
.crd-swap:hover { border-color: var(--crd-blue); }
.crd-tasas-hoy { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; background: #fff; border: 1px solid var(--crd-line); border-radius: 12px; padding: 10px 16px; font-size: .93rem; }
.crd-th-label { background: var(--crd-red); color: #fff; font-weight: 800; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; }
.crd-tasas-hoy a { margin-left: auto; font-weight: 700; text-decoration: none; }

/* Botones */
.crd-buttons, .crd-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crd-btn, .crd-btn-sec {
	font: inherit; font-weight: 700; font-size: 1rem; border-radius: 10px; padding: 12px 26px; cursor: pointer;
	min-height: 48px; transition: transform .05s, background .15s;
}
.crd-btn { background: var(--crd-red); color: #fff; border: 0; }
.crd-btn:hover { background: #a90e1f; }
.crd-btn:active { transform: translateY(1px); }
.crd-btn-sec { background: #fff; color: var(--crd-blue); border: 1.5px solid var(--crd-line); }
.crd-btn-sec:hover { border-color: var(--crd-blue); }

/* Resultado */
.crd-result { margin-top: 24px; outline: none; scroll-margin-top: 90px; animation: crd-in .25s ease-out; }
@keyframes crd-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.crd-total {
	display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
	background: var(--crd-blue); color: #fff; border-radius: 12px; padding: 18px 20px;
}
.crd-total span { font-weight: 600; opacity: .9; }
.crd-total strong { font-size: clamp(1.5rem, 4vw, 2rem); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.crd-items { margin: 14px 0 0; padding: 0; }
.crd-items > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 2px; border-bottom: 1px dashed var(--crd-line); }
.crd-items dt { color: var(--crd-muted); margin: 0; }
.crd-items dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; color: var(--crd-ink); }
.crd-table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--crd-line); border-radius: 10px; }
.crd-scroll { max-height: 380px; overflow-y: auto; }
.crd-table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 0; }
.crd-table th { position: sticky; top: 0; background: var(--crd-soft); text-align: left; padding: 10px 12px; font-weight: 700; color: var(--crd-ink); border: 0; }
.crd-table td { padding: 9px 12px; border-top: 1px solid var(--crd-line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.crd-table tr:last-child td { font-weight: 600; }
.crd-plain tr:last-child td { font-weight: 400; }
.crd-notes { margin: 16px 0 0; padding: 14px 16px 14px 34px; background: var(--crd-soft); border-radius: 10px; font-size: .92rem; color: var(--crd-ink); }
.crd-notes li { margin: 4px 0; }
.crd-actions { margin-top: 14px; }
.crd-disclaimer { font-size: .8rem; color: var(--crd-muted); margin: 10px 0 0 !important; }
.crd-error { background: #fdecee; color: #8f0b1a; border: 1px solid #f6c3ca; border-radius: 10px; padding: 12px 14px; font-weight: 600; }
.crd-ok { background: #e8f6ee; color: var(--crd-ok); border: 1px solid #bfe5cf; border-radius: 10px; padding: 12px 14px; font-weight: 600; margin-bottom: 14px; }

/* Directorio de calculadoras */
.crd-dir-group { margin: 0 0 32px; }
.crd-dir-title { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; color: var(--crd-muted); margin: 0 0 12px !important; }
.crd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.crd-card {
	display: flex; gap: 14px; align-items: flex-start; padding: 18px; border: 1px solid var(--crd-line);
	border-radius: var(--crd-radius); background: #fff; text-decoration: none !important; color: var(--crd-ink);
	transition: border-color .15s, transform .15s, box-shadow .15s;
}
.crd-card:hover { border-color: var(--crd-blue); transform: translateY(-2px); box-shadow: 0 10px 24px -16px rgba(0, 45, 98, .5); }
.crd-card-icon { flex: 0 0 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: #e7eef8; color: var(--crd-blue); }
.crd-cat-impuestos .crd-card-icon { background: #fbe7ea; color: var(--crd-red); }
.crd-card-body { display: flex; flex-direction: column; gap: 3px; }
.crd-card-body strong { font-size: 1.02rem; }
.crd-card-body span { color: var(--crd-muted); font-size: .88rem; line-height: 1.4; }
.crd-related { margin: 40px 0 0; padding-top: 24px; border-top: 1px solid var(--crd-line); }
.crd-related h2 { font-size: 1.25rem; }
.crd-cards-sm .crd-card { padding: 14px; }

/* FAQ */
.crd-faq details { border: 1px solid var(--crd-line); border-radius: 10px; margin: 0 0 10px; background: #fff; }
.crd-faq summary { cursor: pointer; padding: 14px 44px 14px 16px; font-weight: 700; list-style: none; position: relative; }
.crd-faq summary::-webkit-details-marker { display: none; }
.crd-faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--crd-red); font-weight: 400; }
.crd-faq details[open] summary::after { content: "−"; }
.crd-faq details p { padding: 0 16px 14px; margin: 0; color: var(--crd-muted); }

/* Preguntas frecuentes de uso */
.crd-help-toc { background: var(--crd-soft); border-radius: 12px; padding: 14px 16px; font-size: .92rem; line-height: 1.9; margin-bottom: 8px; }
.crd-help-cat { border-top: 4px solid var(--crd-blue); padding-top: 18px; }
.crd-help-sec { scroll-margin-top: 90px; }
.crd-help-tool { border: 1px solid var(--crd-line); border-radius: var(--crd-radius); padding: 4px 20px 8px; margin: 0 0 18px; }
.crd-steps { counter-reset: paso; list-style: none; padding: 0 !important; }
.crd-steps li { counter-increment: paso; position: relative; padding: 4px 0 4px 40px; margin: 6px 0; }
.crd-steps li::before { content: counter(paso); position: absolute; left: 0; top: 3px; width: 28px; height: 28px; border-radius: 8px; background: var(--crd-red); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: .85rem; }
.crd-help-go { font-weight: 700; text-decoration: none; }

/* Contacto */
.crd-contact { display: grid; gap: 16px; max-width: 640px; }
.crd-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 560px) {
	.crd-btn, .crd-btn-sec { flex: 1 1 auto; }
	.crd-items > div { flex-direction: column; gap: 2px; }
	.crd-items dd { text-align: left; }
	.crd-seg { display: flex; }
	.crd-seg label { flex: 1; text-align: center; }
}

@media print {
	body * { visibility: hidden; }
	.crd-calc, .crd-calc * { visibility: visible; }
	.crd-calc { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 0; }
	.crd-buttons, .crd-actions { display: none; }
	.crd-total { background: #fff; color: #000; border: 2px solid #000; }
}
