/* CSS/tax.css — Calendario tributario (panel con pestañas). Tokens del tema (claro/oscuro).
   Mobile-first: una columna, sin anchos fijos, el texto largo envuelve; nada de scroll horizontal. */

.tax-root {
    --tax-renta: #3b82f6; --tax-iva: #8b5cf6; --tax-retencion: #f59e0b; --tax-simple: #14b8a6; --tax-otros: #ec4899;
    --tax-ok: var(--success-color, #198754); --tax-warn: #f59e0b; --tax-bad: var(--danger-color, #dc3545);
    --tax-soft: rgba(128, 128, 128, 0.12);
    display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.tax-root * { box-sizing: border-box; }
.tax-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tax-muted { margin: 0; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; overflow-wrap: anywhere; }
.tax-warn-line { margin: 0; font-size: 0.85rem; font-weight: 700; color: var(--tax-warn); line-height: 1.5; overflow-wrap: anywhere; }
.tax-hint-line { margin: 0; font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; padding: 10px 12px; border-radius: 12px; background: var(--tax-soft); overflow-wrap: anywhere; }

/* ---------- Botones ---------- */
.tax-btn {
    min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--card-bg);
    color: var(--text-primary); font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 0;
    transition: transform 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}
.tax-btn i, .tax-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.tax-btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--primary-color); }
.tax-btn.primary { background: var(--primary-color); border-color: transparent; color: #fff; }
.tax-btn.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: transparent; }
.tax-btn.ghost { background: transparent; }
.tax-btn.light { background: rgba(255, 255, 255, 0.95); color: #0f172a; border-color: transparent; }
.tax-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.tax-btn:focus-visible, .tax-tab:focus-visible, .tax-cell:focus-visible, .tax-filter:focus-visible, .tax-iconbtn:focus-visible, .tax-done:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.tax-iconbtn { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-primary); display: grid; place-items: center; cursor: pointer; }
.tax-iconbtn i, .tax-iconbtn svg { width: 18px; height: 18px; }
.tax-link { border: 0; background: transparent; color: var(--primary-color); font: inherit; font-size: 0.85rem; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; cursor: pointer; padding: 6px 2px; }
.tax-link i, .tax-link svg { width: 16px; height: 16px; }

/* ---------- Encabezado ---------- */
.tax-hero { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #0b3b8f 0%, #4338ca 55%, #7c3aed 100%); box-shadow: 0 14px 34px rgba(67, 56, 202, 0.28); }
.tax-hero-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tax-hero-icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: 15px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.18); }
.tax-hero-icon i, .tax-hero-icon svg { width: 24px; height: 24px; }
.tax-hero-text { flex: 1 1 200px; min-width: 0; }
.tax-hero h2 { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
.tax-hero p { margin: 2px 0 0; font-size: 0.85rem; opacity: 0.88; line-height: 1.4; }
.tax-hero .tax-btn.ghost { color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.tax-hero .tax-btn.ghost:hover:not(:disabled) { border-color: #fff; background: rgba(255, 255, 255, 0.12); }
.tax-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tax-chips:empty { display: none; }
.tax-chip { padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: rgba(255, 255, 255, 0.18); color: #fff; }

/* ---------- Pestañas ---------- */
.tax-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 4px; border-radius: 16px; background: var(--card-bg); border: 1px solid var(--card-border); position: sticky; top: 0; z-index: 5; }
.tax-tab { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 2px; border: 0; border-radius: 12px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.68rem; font-weight: 700; cursor: pointer; }
.tax-tab i, .tax-tab svg { width: 19px; height: 19px; }
.tax-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tax-tab.is-on { background: var(--primary-color); color: #fff; }
.tax-panel { min-width: 0; }

/* ---------- Tarjetas y secciones ---------- */
.tax-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tax-section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tax-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tax-section-head h3 { margin: 0; font-size: 1rem; font-weight: 800; color: var(--text-primary); overflow-wrap: anywhere; }
.tax-feed { display: flex; flex-direction: column; gap: 10px; }
.tax-foot { margin: 4px 0 0; font-size: 0.76rem; color: var(--text-secondary); line-height: 1.5; text-align: center; overflow-wrap: anywhere; }

/* ---------- Próximo vencimiento ---------- */
.tax-next { display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center; padding: 18px; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 12px 30px rgba(16, 185, 129, 0.25); }
.tax-next.is-soon { background: linear-gradient(135deg, #d97706, #f59e0b); box-shadow: 0 12px 30px rgba(245, 158, 11, 0.28); }
.tax-next.is-today { background: linear-gradient(135deg, #b91c1c, #ef4444); box-shadow: 0 12px 30px rgba(239, 68, 68, 0.3); }
.tax-next-count { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 78px; padding: 10px 8px; border-radius: 16px; background: rgba(255, 255, 255, 0.2); }
.tax-next-count b { font-size: 2rem; font-weight: 800; line-height: 1; }
.tax-next-count span { margin-top: 3px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.92; }
.tax-next-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tax-next-kicker { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; }
.tax-next h3 { margin: 0; font-size: 1.12rem; font-weight: 800; line-height: 1.25; color: #fff; overflow-wrap: anywhere; }
.tax-next-date { margin: 0; font-size: 0.95rem; font-weight: 700; }
.tax-next-meta { margin: 0; font-size: 0.8rem; opacity: 0.9; overflow-wrap: anywhere; }
.tax-next > .tax-btn { grid-column: 1 / -1; }
.tax-next .tax-badge { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* ---------- KPIs ---------- */
.tax-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tax-kpi { display: flex; flex-direction: column; gap: 4px; padding: 12px 10px; border-radius: 14px; background: var(--card-bg); border: 1px solid var(--card-border); min-width: 0; }
.tax-kpi b { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.tax-kpi span { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.3; overflow-wrap: anywhere; }
.tax-kpi.is-bad b { color: var(--tax-bad); }
.tax-kpi.is-warn b { color: var(--tax-warn); }
.tax-kpi.is-ok b { color: var(--tax-ok); }
.tax-actions { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Tarjeta de vencimiento ---------- */
.tax-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px; border-radius: 16px; background: var(--card-bg); border: 1px solid var(--card-border); border-left: 4px solid var(--tax-otros); min-width: 0; }
.tax-item.g-renta { border-left-color: var(--tax-renta); }
.tax-item.g-iva { border-left-color: var(--tax-iva); }
.tax-item.g-retencion { border-left-color: var(--tax-retencion); }
.tax-item.g-simple { border-left-color: var(--tax-simple); }
.tax-item.is-overdue { opacity: 0.78; }
.tax-item.is-done { opacity: 0.62; }
.tax-item.is-done .tax-item-title { text-decoration: line-through; }
.tax-datebox { width: 52px; flex-shrink: 0; padding: 6px 4px; border-radius: 12px; text-align: center; background: var(--tax-soft); display: flex; flex-direction: column; gap: 2px; }
.tax-datebox b { font-size: 1.05rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.tax-datebox span { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; color: var(--text-secondary); }
.tax-item-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.tax-item-title { margin: 0; font-size: 0.95rem; font-weight: 800; color: var(--text-primary); line-height: 1.3; overflow-wrap: anywhere; }
.tax-item-meta { margin: 0; font-size: 0.78rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.tax-item-detail { margin: 0; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.45; overflow-wrap: anywhere; }
.tax-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tax-when { padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; background: var(--tax-soft); color: var(--text-primary); }
.tax-when.is-today { background: var(--tax-bad); color: #fff; }
.tax-when.is-soon { background: var(--tax-warn); color: #1f1300; }
.tax-when.is-later { background: rgba(25, 135, 84, 0.16); color: var(--tax-ok); }
.tax-when.is-done { background: rgba(25, 135, 84, 0.16); color: var(--tax-ok); }
.tax-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; max-width: 100%; }
.tax-badge i, .tax-badge svg { width: 13px; height: 13px; flex-shrink: 0; }
.tax-badge span { overflow-wrap: anywhere; }
.tax-badge.is-ok { background: rgba(25, 135, 84, 0.14); color: var(--tax-ok); }
.tax-badge.is-warn { background: rgba(245, 158, 11, 0.18); color: #b45309; }
body.dark-mode .tax-badge.is-warn { color: #fbbf24; }
.tax-done { width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--card-border); background: transparent; color: var(--text-secondary); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.tax-done i, .tax-done svg { width: 18px; height: 18px; }
.tax-done:hover { border-color: var(--tax-ok); color: var(--tax-ok); }
.tax-done.is-on { background: var(--tax-ok); border-color: var(--tax-ok); color: #fff; }

/* ---------- Calendario mensual ---------- */
.tax-monthnav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tax-monthnav h3 { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--text-primary); text-align: center; flex: 1; }
.tax-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px; border-radius: 18px; background: var(--card-bg); border: 1px solid var(--card-border); }
.tax-dow { text-align: center; font-size: 0.7rem; font-weight: 800; color: var(--text-secondary); padding: 4px 0; }
.tax-cell { position: relative; min-width: 0; min-height: 46px; border: 0; border-radius: 12px; background: transparent; color: var(--text-primary); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 2px; }
.tax-cell.is-blank { pointer-events: none; }
.tax-cell-n { font-size: 0.88rem; font-weight: 700; }
.tax-cell.is-off .tax-cell-n { color: var(--text-secondary); opacity: 0.55; }
.tax-cell.has-items { background: var(--tax-soft); }
.tax-cell.is-today { box-shadow: inset 0 0 0 2px var(--primary-color); }
.tax-cell.is-selected { background: var(--primary-color); }
.tax-cell.is-selected .tax-cell-n { color: #fff; opacity: 1; }
.tax-dots { display: flex; gap: 3px; height: 6px; align-items: center; }
.tax-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--tax-otros); flex-shrink: 0; }
.tax-dot.g-renta { background: var(--tax-renta); }
.tax-dot.g-iva { background: var(--tax-iva); }
.tax-dot.g-retencion { background: var(--tax-retencion); }
.tax-dot.g-simple { background: var(--tax-simple); }
.tax-dot.is-done { opacity: 0.35; }
.tax-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.75rem; color: var(--text-secondary); }
.tax-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tax-legend-off { width: 100%; opacity: 0.85; }

/* ---------- Lista y filtros ---------- */
.tax-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.tax-filter { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-primary); font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
.tax-filter.is-on { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }

/* ---------- Mi renta ---------- */
.tax-bignum { display: flex; flex-direction: column; gap: 2px; }
.tax-bignum b { font-size: 1.7rem; font-weight: 800; color: var(--text-primary); overflow-wrap: anywhere; }
.tax-bignum span { font-size: 0.82rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.tax-bar { height: 12px; border-radius: 999px; background: var(--tax-soft); overflow: hidden; }
.tax-bar-fill { height: 100%; border-radius: 999px; background: var(--tax-ok); transition: width 0.4s ease; }
.tax-estimate.is-over .tax-bar-fill { background: var(--tax-bad); }
.tax-rows { display: flex; flex-direction: column; }
.tax-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--card-border); }
.tax-row:last-child { border-bottom: 0; }
.tax-row-label { font-size: 0.88rem; color: var(--text-primary); min-width: 0; overflow-wrap: anywhere; }
.tax-row-value { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; text-align: right; }
.tax-row-value b { font-size: 0.92rem; font-weight: 800; color: var(--text-primary); }
.tax-row-value small { font-size: 0.72rem; color: var(--text-secondary); }
.tax-checklist { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; color: var(--text-primary); line-height: 1.45; }
.tax-checklist li { overflow-wrap: anywhere; }

/* ---------- Guía ---------- */
.tax-legend-row { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.tax-legend-row p { margin: 0; font-size: 0.82rem; color: var(--text-secondary); line-height: 1.45; }
.tax-acc { border: 1px solid var(--card-border); border-radius: 16px; background: var(--card-bg); overflow: hidden; }
.tax-acc-sum { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; user-select: none; }
.tax-acc-sum::-webkit-details-marker { display: none; }
.tax-acc-icon { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; background: rgba(13, 110, 253, 0.12); color: var(--primary-color); }
.tax-acc-icon i, .tax-acc-icon svg { width: 18px; height: 18px; }
.tax-acc-title { flex: 1; min-width: 0; font-size: 0.95rem; font-weight: 800; color: var(--text-primary); overflow-wrap: anywhere; }
.tax-acc-form { flex-shrink: 0; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; background: var(--tax-soft); color: var(--text-secondary); }
.tax-acc-chev { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-secondary); transition: transform 0.2s ease; }
.tax-acc[open] .tax-acc-chev { transform: rotate(180deg); }
.tax-acc-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.tax-acc-body p { margin: 0; font-size: 0.88rem; line-height: 1.55; color: var(--text-primary); overflow-wrap: anywhere; }
.tax-links { display: flex; flex-direction: column; gap: 8px; }
.tax-link-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--card-border); color: var(--primary-color); font-size: 0.88rem; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.tax-link-row i, .tax-link-row svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Estado vacío ---------- */
.tax-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 18px; border-radius: 20px; border: 1px dashed var(--card-border); background: var(--card-bg); }
.tax-empty-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.tax-empty-icon i, .tax-empty-icon svg { width: 28px; height: 28px; }
.tax-empty h3 { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--text-primary); }
.tax-empty p { margin: 0; max-width: 46ch; font-size: 0.88rem; line-height: 1.55; color: var(--text-secondary); }

/* ---------- Hoja del perfil ---------- */
html.tax-sheet-open, html.tax-sheet-open body { overflow: hidden; }
.tax-overlay { position: fixed; inset: 0; z-index: 9100; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.55); }
.tax-sheet { width: 100%; max-height: 94dvh; display: flex; flex-direction: column; background: var(--card-bg); color: var(--text-primary); border: 1px solid var(--card-border); border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35); outline: none; animation: tax-up 0.22s ease-out; }
@keyframes tax-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.tax-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 8px; flex: none; }
.tax-sheet-head h3 { margin: 0; font-size: 1.1rem; font-weight: 800; }
.tax-sheet-body { padding: 4px 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.tax-sheet-foot { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--card-border); flex: none; }
.tax-label { font-size: 0.76rem; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.tax-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tax-field input, .tax-opt select { width: 100%; min-width: 0; min-height: 46px; padding: 0 12px; border-radius: 12px; font: inherit; font-size: 1rem; background: var(--input-bg); color: var(--text-primary); border: 1px solid var(--card-border); }
.tax-field input:focus, .tax-opt select:focus { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.tax-hint { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; }
.tax-preview { margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 0.82rem; font-weight: 700; color: var(--primary-color); background: rgba(13, 110, 253, 0.1); overflow-wrap: anywhere; }
.tax-preview[hidden] { display: none; }
.tax-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 12px; background: var(--input-bg); border: 1px solid var(--card-border); }
.tax-seg button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--text-secondary); font: inherit; font-weight: 800; cursor: pointer; }
.tax-seg button.is-on { background: var(--primary-color); color: #fff; }
.tax-opts { display: flex; flex-direction: column; gap: 8px; }
.tax-opt { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--input-bg); cursor: pointer; min-width: 0; }
.tax-opt.is-on { border-color: var(--primary-color); background: rgba(13, 110, 253, 0.08); }
.tax-opt input[type="checkbox"] { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--primary-color); }
.tax-opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tax-opt-text b { font-size: 0.92rem; color: var(--text-primary); overflow-wrap: anywhere; }
.tax-opt-text small { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; overflow-wrap: anywhere; }
.tax-opt-select { flex-direction: column; align-items: stretch; cursor: default; }
.tax-opt-sub { margin-left: 22px; }

@media (min-width: 640px) {
    .tax-tab { flex-direction: row; gap: 8px; font-size: 0.85rem; padding: 10px 6px; }
    .tax-actions { flex-direction: row; }
    .tax-actions .tax-btn { flex: 1; }
    .tax-overlay { align-items: center; padding: 20px; }
    .tax-sheet { max-width: 520px; border-radius: 22px; border-bottom: 1px solid var(--card-border); }
    .tax-sheet-foot { flex-direction: row-reverse; }
    .tax-sheet-foot .tax-btn { flex: 1; }
    .tax-next { grid-template-columns: auto 1fr auto; }
    .tax-next > .tax-btn { grid-column: auto; }
}
@media (min-width: 900px) {
    .tax-root { max-width: 920px; margin-left: auto; margin-right: auto; }
    .tax-feed { display: grid; grid-template-columns: 1fr 1fr; }
    .tax-cell { min-height: 58px; }
}
@media (prefers-reduced-motion: reduce) { .tax-sheet { animation: none; } .tax-bar-fill, .tax-acc-chev { transition: none; } .tax-btn { transition: none; } }
.tax-next .tax-badge.is-ok, .tax-next .tax-badge.is-warn { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* =================================================================== */
/* Cartera de clientes, vencimientos propios y exógena                   */
/* =================================================================== */
.tax-root { --tax-propios: #06b6d4; }
.tax-item.g-propios { border-left-color: var(--tax-propios); }
.tax-dot.g-propios { background: var(--tax-propios); }
.tax-badge.is-info { background: rgba(6, 182, 212, 0.16); color: #0e7490; }
body.dark-mode .tax-badge.is-info { color: #67e8f9; }
.tax-next .tax-badge.is-info { background: rgba(255, 255, 255, 0.22); color: #fff; }
.tax-item-icon { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; color: var(--tax-propios); }
.tax-btn.danger { color: var(--tax-bad); border-color: rgba(220, 53, 69, 0.45); background: transparent; }
.tax-btn.danger:hover:not(:disabled) { background: rgba(220, 53, 69, 0.1); border-color: var(--tax-bad); }
.tax-empty-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px; }
.tax-notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 0.86rem; line-height: 1.5; overflow-wrap: anywhere; background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.4); color: var(--text-primary); }
.tax-notice.is-bad { background: rgba(220, 53, 69, 0.12); border-color: rgba(220, 53, 69, 0.45); }
.tax-notice i, .tax-notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--tax-warn); }
.tax-health.is-warn { border-color: rgba(245, 158, 11, 0.5); }
.tax-health.is-bad { border-color: rgba(220, 53, 69, 0.55); }

/* Selector de cliente en el encabezado */
.tax-switcher { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.tax-who-btn { flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.12); color: #fff; font: inherit; cursor: pointer; text-align: left; }
.tax-who-btn:hover { background: rgba(255, 255, 255, 0.2); }
.tax-who-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tax-who-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tax-who-text b { font-size: 0.95rem; font-weight: 800; overflow-wrap: anywhere; }
.tax-who-text small { font-size: 0.75rem; opacity: 0.85; overflow-wrap: anywhere; }
.tax-who-chev { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.tax-avatar { width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 1rem; color: #fff; background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.tax-who-btn .tax-avatar { background: rgba(255, 255, 255, 0.22); }

/* Cartera */
.tax-kpis.is-4 { grid-template-columns: repeat(2, 1fr); }
.tax-search { width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; font: inherit; font-size: 1rem; background: var(--input-bg); color: var(--text-primary); border: 1px solid var(--card-border); }
.tax-search:focus { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.tax-clients { display: flex; flex-direction: column; gap: 8px; }
.tax-client { border: 1px solid var(--card-border); border-radius: 16px; background: var(--card-bg); overflow: hidden; }
.tax-client-main { width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 0; background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.tax-client-main:hover { background: var(--hover-bg); }
.tax-client-main:focus-visible { outline: 2px solid var(--primary-color); outline-offset: -2px; }
.tax-client-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tax-client-name { font-size: 0.98rem; font-weight: 800; overflow-wrap: anywhere; }
.tax-client-info small { font-size: 0.78rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.tax-client-next { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tax-client-next-title { font-size: 0.8rem; color: var(--text-secondary); overflow-wrap: anywhere; min-width: 0; }
.tax-client-exo { font-size: 0.75rem; font-weight: 700; color: var(--tax-ok); }
.tax-client-chev { width: 18px; height: 18px; flex-shrink: 0; margin-top: 10px; color: var(--text-secondary); }
.tax-pill { padding: 2px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; background: var(--tax-soft); color: var(--text-primary); }
.tax-pill.is-bad { background: var(--tax-bad); color: #fff; }
.tax-pill.is-today { background: var(--tax-bad); color: #fff; }
.tax-pill.is-soon { background: var(--tax-warn); color: #1f1300; }
.tax-pill.is-later { background: rgba(25, 135, 84, 0.16); color: var(--tax-ok); }
.tax-pill.is-warn { background: rgba(245, 158, 11, 0.2); color: #b45309; }
body.dark-mode .tax-pill.is-warn { color: #fbbf24; }
.tax-who { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--card-border); background: var(--input-bg); color: var(--primary-color); font: inherit; font-size: 0.75rem; font-weight: 800; cursor: pointer; }
.tax-who i, .tax-who svg { width: 13px; height: 13px; flex-shrink: 0; }
.tax-who span { overflow-wrap: anywhere; text-align: left; }
.tax-mini-verdict { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 16px; border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.tax-mini-verdict > i, .tax-mini-verdict > svg { width: 26px; height: 26px; flex-shrink: 0; }
.tax-mini-verdict span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tax-mini-verdict b { font-size: 0.95rem; overflow-wrap: anywhere; }
.tax-mini-verdict small { font-size: 0.78rem; color: var(--text-secondary); }
.tax-mini-verdict.is-yes { border-color: rgba(220, 53, 69, 0.5); }
.tax-mini-verdict.is-yes > i, .tax-mini-verdict.is-yes > svg { color: var(--tax-bad); }
.tax-mini-verdict.is-no { border-color: rgba(25, 135, 84, 0.5); }
.tax-mini-verdict.is-no > i, .tax-mini-verdict.is-no > svg { color: var(--tax-ok); }

/* Vencimientos propios */
.tax-customs { display: flex; flex-direction: column; gap: 8px; }
.tax-custom { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--input-bg); }
.tax-custom-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 11px; display: grid; place-items: center; background: rgba(6, 182, 212, 0.16); color: #0e7490; }
body.dark-mode .tax-custom-icon { color: #67e8f9; }
.tax-custom-icon i, .tax-custom-icon svg { width: 18px; height: 18px; }
.tax-custom-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tax-custom-text b { font-size: 0.92rem; overflow-wrap: anywhere; }
.tax-custom-text small { font-size: 0.76rem; color: var(--text-secondary); }
.tax-kindchips { display: flex; flex-wrap: wrap; gap: 8px; }
.tax-kindchip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--card-border); background: var(--input-bg); color: var(--text-primary); font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; max-width: 100%; }
.tax-kindchip i, .tax-kindchip svg { width: 16px; height: 16px; flex-shrink: 0; }
.tax-kindchip.is-on { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.tax-sheet-body textarea, .tax-field select, .tax-field input[type="date"] { width: 100%; min-width: 0; padding: 10px 12px; border-radius: 12px; font: inherit; font-size: 1rem; background: var(--input-bg); color: var(--text-primary); border: 1px solid var(--card-border); }
.tax-field select, .tax-field input[type="date"] { min-height: 46px; padding-top: 0; padding-bottom: 0; }
.tax-sheet-body textarea:focus, .tax-field select:focus, .tax-field input[type="date"]:focus { outline: 2px solid var(--primary-color); outline-offset: 1px; }

/* Exógena */
.tax-upload .tax-btn { align-self: flex-start; }
.tax-verdict { border-width: 2px; }
.tax-verdict.is-yes { border-color: rgba(220, 53, 69, 0.55); }
.tax-verdict.is-no { border-color: rgba(25, 135, 84, 0.55); }
.tax-verdict-head { display: flex; gap: 12px; align-items: center; }
.tax-verdict-head h3 { margin: 2px 0 0; font-size: 1.1rem; font-weight: 800; color: var(--text-primary); overflow-wrap: anywhere; }
.tax-verdict-head .tax-next-kicker { color: var(--text-secondary); }
.tax-verdict-icon { width: 46px; height: 46px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center; color: #fff; }
.tax-verdict.is-yes .tax-verdict-icon { background: var(--tax-bad); }
.tax-verdict.is-no .tax-verdict-icon { background: var(--tax-ok); }
.tax-verdict-icon i, .tax-verdict-icon svg { width: 24px; height: 24px; }
.tax-gauges { display: flex; flex-direction: column; gap: 12px; }
.tax-gauge { display: flex; flex-direction: column; gap: 5px; }
.tax-gauge-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tax-gauge-label { font-size: 0.85rem; color: var(--text-primary); overflow-wrap: anywhere; min-width: 0; }
.tax-gauge-value { font-size: 0.85rem; text-align: right; }
.tax-gauge-value b { font-weight: 800; color: var(--text-primary); }
.tax-gauge-value small { color: var(--text-secondary); font-size: 0.75rem; }
.tax-gauge.is-over .tax-bar-fill { background: var(--tax-bad); }
.tax-gauge.is-over .tax-gauge-value b { color: var(--tax-bad); }
.tax-deadline { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--tax-soft); }
.tax-deadline > i, .tax-deadline > svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--primary-color); }
.tax-deadline span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tax-deadline b { font-size: 0.92rem; overflow-wrap: anywhere; }
.tax-deadline small { font-size: 0.76rem; color: var(--text-secondary); }
.tax-subh { margin: 6px 0 0; font-size: 0.88rem; font-weight: 800; color: var(--text-primary); }
.tax-line { padding: 10px 0; border-bottom: 1px solid var(--card-border); display: flex; flex-direction: column; gap: 3px; }
.tax-line:last-child { border-bottom: 0; }
.tax-line-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.tax-line-who { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; min-width: 0; }
.tax-line-val { font-size: 0.88rem; font-weight: 800; flex-shrink: 0; color: var(--text-primary); }
.tax-line-what { margin: 0; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; overflow-wrap: anywhere; }
.tax-line-tags { margin: 0; font-size: 0.72rem; font-weight: 700; color: var(--primary-color); overflow-wrap: anywhere; }
.tax-compare { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(var(--cols, 2), minmax(0, 1fr)); gap: 6px 8px; font-size: 0.8rem; }
.tax-compare-h { font-weight: 800; color: var(--text-secondary); text-align: right; }
.tax-compare-l { color: var(--text-primary); overflow-wrap: anywhere; }
.tax-compare-v { text-align: right; font-weight: 700; color: var(--text-primary); }

/* Importación */
.tax-import { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--input-bg); }
.tax-import.is-error { border-color: rgba(220, 53, 69, 0.5); }
.tax-import.is-dup { opacity: 0.6; }
.tax-import-top { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.tax-import-top input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--primary-color); }
.tax-import-name { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; min-width: 0; }
.tax-import-who { margin: 0; font-size: 0.92rem; font-weight: 800; color: var(--text-primary); overflow-wrap: anywhere; }
.tax-import-verdict { margin: 0; font-size: 0.82rem; font-weight: 800; overflow-wrap: anywhere; }
.tax-import-verdict.is-yes { color: var(--tax-bad); }
.tax-import-verdict.is-no { color: var(--tax-ok); }

@media (min-width: 640px) {
    .tax-kpis.is-4 { grid-template-columns: repeat(4, 1fr); }
    .tax-empty-actions { flex-direction: row; max-width: none; justify-content: center; }
}

/* =================================================================== */
/* Mejoras: pestañas dinámicas, calendario, franja del año, documentos   */
/* =================================================================== */
.tax-tabs { grid-template-columns: repeat(6, 1fr); }
.tax-tab { position: relative; }
.tax-tab, .tax-filter, .tax-cell, .tax-ymonth, .tax-docs-mini { -webkit-tap-highlight-color: transparent; }

/* Calendario */
.tax-monthtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 0; }
.tax-monthtitle h3 { flex: none; }
.tax-monthtitle .tax-link { padding: 2px 4px; font-size: 0.78rem; }
.tax-monthsum { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tax-grid { touch-action: pan-y; }
.tax-grid.slide-next { animation: tax-slide-next 0.22s ease-out; }
.tax-grid.slide-prev { animation: tax-slide-prev 0.22s ease-out; }
@keyframes tax-slide-next { from { transform: translateX(18px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes tax-slide-prev { from { transform: translateX(-18px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.tax-cell.has-overdue:not(.is-selected) { box-shadow: inset 0 0 0 1.5px rgba(220, 53, 69, 0.7); }
.tax-cell.is-today.has-overdue:not(.is-selected) { box-shadow: inset 0 0 0 2px var(--primary-color); }
.tax-dots { min-height: 10px; }
.tax-dots-more { font-size: 0.6rem; font-weight: 800; line-height: 1; color: var(--text-secondary); }
.tax-cell.is-selected .tax-dots-more { color: #fff; }
#tax-day-list { scroll-margin-top: 70px; }

/* Filtros con contador */
.tax-filter { display: inline-flex; align-items: center; gap: 6px; }
.tax-filter-n { font-style: normal; font-size: 0.7rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--tax-soft); color: var(--text-secondary); }
.tax-filter.is-on .tax-filter-n { background: rgba(255, 255, 255, 0.25); color: #fff; }
.tax-filter.is-toggle i, .tax-filter.is-toggle svg { width: 15px; height: 15px; }

/* Franja del año */
.tax-year { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tax-ymonth { min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-primary); font: inherit; cursor: pointer; }
.tax-ymonth-name { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
.tax-ymonth-n { font-size: 1.05rem; font-weight: 800; line-height: 1; }
.tax-ymonth.l-1 { background: rgba(59, 130, 246, 0.1); }
.tax-ymonth.l-2 { background: rgba(59, 130, 246, 0.2); }
.tax-ymonth.l-3 { background: rgba(59, 130, 246, 0.32); }
.tax-ymonth.l-4 { background: rgba(59, 130, 246, 0.46); }
.tax-ymonth.is-clear .tax-ymonth-n { color: var(--tax-ok); }
.tax-ymonth.has-overdue { border-color: rgba(220, 53, 69, 0.65); }
.tax-ymonth.has-overdue .tax-ymonth-n { color: var(--tax-bad); }
.tax-ymonth.is-now { box-shadow: inset 0 0 0 2px var(--primary-color); }
.tax-ymonth:focus-visible, .tax-docs-mini:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

/* Documentos */
.tax-docs-mini { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 16px; border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.tax-docs-mini-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; background: rgba(13, 110, 253, 0.12); color: var(--primary-color); }
.tax-docs-mini-icon i, .tax-docs-mini-icon svg { width: 20px; height: 20px; }
.tax-docs-mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tax-docs-mini-text b { font-size: 0.95rem; overflow-wrap: anywhere; }
.tax-docs-mini-text small { font-size: 0.78rem; color: var(--text-secondary); }
.tax-docs-mini .tax-bar { display: block; height: 8px; }
.tax-docs-mini .tax-bar-fill { display: block; }
.tax-docs-count { display: flex; align-items: baseline; gap: 2px; color: var(--text-secondary); font-size: 0.9rem; }
.tax-docs-count b { font-size: 1.7rem; font-weight: 800; color: var(--text-primary); }
.tax-docsec-hint { color: var(--text-secondary) !important; font-size: 0.8rem !important; }
.tax-acc-form.is-full { background: rgba(25, 135, 84, 0.16); color: var(--tax-ok); }
.tax-doc { display: flex; align-items: flex-start; gap: 12px; padding: 12px; min-height: 48px; border-radius: 14px; border: 1px solid var(--card-border); background: var(--input-bg); cursor: pointer; min-width: 0; }
.tax-doc input[type="checkbox"] { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; accent-color: var(--tax-ok); }
.tax-doc-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.tax-doc-text b { font-size: 0.9rem; line-height: 1.35; color: var(--text-primary); overflow-wrap: anywhere; }
.tax-doc-text small { font-size: 0.78rem; line-height: 1.45; color: var(--text-secondary); overflow-wrap: anywhere; }
.tax-doc-exo { align-self: flex-start; max-width: 100%; padding: 2px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; background: rgba(13, 110, 253, 0.12); color: var(--primary-color); overflow-wrap: anywhere; }
.tax-doc-exo.is-possible { background: var(--tax-soft); color: var(--text-secondary); }
.tax-doc.is-on { border-color: rgba(25, 135, 84, 0.5); background: rgba(25, 135, 84, 0.07); }
.tax-doc.is-on .tax-doc-text b { text-decoration: line-through; color: var(--text-secondary); }
.tax-doc:focus-within { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.tax-notice.is-ok { background: rgba(25, 135, 84, 0.12); border-color: rgba(25, 135, 84, 0.45); }
.tax-notice.is-ok i, .tax-notice.is-ok svg { color: var(--tax-ok); }

/* Seis pestañas en teléfonos: solo la activa muestra su nombre (los demás quedan como ícono, con nombre para lectores) */
@media (max-width: 480px) {
    .tax-tabs { display: flex; }
    .tax-tab { flex: 1 1 0; }
    .tax-tab.is-on { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 8px 12px; font-size: 0.78rem; }
    .tax-tab:not(.is-on) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (min-width: 640px) {
    .tax-year { grid-template-columns: repeat(6, 1fr); }
    .tax-tab { font-size: 0.8rem; }
}
@media (min-width: 900px) {
    .tax-year { grid-template-columns: repeat(12, 1fr); }
    .tax-doc:hover { border-color: var(--primary-color); }
}
@media (prefers-reduced-motion: reduce) { .tax-grid.slide-next, .tax-grid.slide-prev { animation: none; } }

/* Cartera: acciones junto al título */
.tax-section-head:has(.tax-head-actions) { flex-wrap: wrap; }
.tax-head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.tax-import .tax-notice { margin-top: 2px; }
@media (max-width: 480px) { .tax-head-actions { width: 100%; } .tax-head-actions .tax-btn { flex: 1 1 0; padding: 0 10px; } }
