﻿@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
   DISEÑO DE SISTEMA - PALETA FORMULA CLICK
   Charcoal #312E2B (marca) · UI oscura #141414 · Stone #CFCCC2 · Cream #F4F2E7 · Orange #FF8700
   ========================================================================== */
:root {
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --brand-charcoal: #312E2B;
    --brand-charcoal-deep: #282624;
    --brand-charcoal-rgb: 49, 46, 43;
    --brand-stone: #CFCCC2;
    --brand-cream: #F4F2E7;
    --brand-orange: #FF8700;
    --brand-orange-deep: #E67800;
    --brand-orange-soft: #FFAD5C;
    --brand-orange-pale: #FFD4A8;

    --accent-strong: var(--brand-orange);
    --accent-focus: #FF9619;
    --accent-icon: var(--brand-orange-soft);
    --accent-text-soft: var(--brand-orange-pale);
    --accent-bg: rgba(255, 135, 0, 0.12);
    --accent-bg-strong: rgba(255, 135, 0, 0.18);
    --accent-border: rgba(255, 135, 0, 0.35);
    --accent-border-soft: rgba(255, 135, 0, 0.22);
    --accent-shadow: rgba(255, 135, 0, 0.28);
    --accent-secondary: #6B665E;

    --color-success: hsl(142, 55%, 38%);
    --color-success-bg: hsla(142, 55%, 38%, 0.12);
    --color-warning: var(--brand-orange);
    --color-warning-bg: rgba(255, 135, 0, 0.12);
    --color-danger: hsl(4, 72%, 48%);
    --color-danger-bg: hsla(4, 72%, 48%, 0.12);

    --shadow-sm: 0 4px 6px -1px rgba(49, 46, 43, 0.08), 0 2px 4px -1px rgba(49, 46, 43, 0.04);
    --shadow-md: 0 10px 15px -3px rgba(49, 46, 43, 0.12), 0 4px 6px -2px rgba(49, 46, 43, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(49, 46, 43, 0.16), 0 10px 10px -5px rgba(49, 46, 43, 0.08);
    --blur-effect: blur(16px) saturate(160%);
}

html[data-theme="dark"],
html:not([data-theme]) {
    color-scheme: dark;
    --bg-main: #0A0A0A;
    --bg-surface: #0A0A0A;
    --bg-surface-solid: #0A0A0A;
    --bg-panel: #111111;
    --bg-elevated: #161616;
    --bg-input: #070707;
    --bg-btn-secondary: rgba(255, 255, 255, 0.04);
    --bg-btn-secondary-hover: rgba(255, 255, 255, 0.06);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(255, 135, 0, 0.1);
    --primary-gradient: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-orange-deep) 100%);
    --accent-glow: linear-gradient(135deg, rgba(255, 135, 0, 0.18) 0%, rgba(230, 120, 0, 0.08) 100%);
    --text-primary: var(--brand-cream);
    --text-secondary: #A8A5A0;
    --text-muted: rgba(207, 204, 194, 0.38);
    --bg-gradient-1: transparent;
    --bg-gradient-2: transparent;
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --chart-border: #0A0A0A;
    --bg-overlay: #0A0A0A;
    --accent-secondary: #75726C;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -1px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.52), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.58), 0 10px 10px -5px rgba(0, 0, 0, 0.34);
}

html[data-theme="light"] {
    color-scheme: light;
    --bg-main: #FAFAF8;
    --bg-surface: #FFFFFF;
    --bg-surface-solid: #FFFFFF;
    --bg-panel: #FFFFFF;
    --bg-input: rgba(49, 46, 43, 0.04);
    --bg-btn-secondary: rgba(49, 46, 43, 0.04);
    --bg-btn-secondary-hover: rgba(49, 46, 43, 0.07);
    --border-color: rgba(49, 46, 43, 0.1);
    --border-glow: rgba(255, 135, 0, 0.08);
    --primary-gradient: linear-gradient(135deg, var(--brand-orange) 0%, #FFA033 100%);
    --accent-glow: linear-gradient(135deg, rgba(255, 135, 0, 0.12) 0%, rgba(255, 160, 51, 0.08) 100%);
    --text-primary: var(--brand-charcoal);
    --text-secondary: #5C5852;
    --text-muted: rgba(49, 46, 43, 0.48);
    --bg-gradient-1: transparent;
    --bg-gradient-2: transparent;
    --scrollbar-thumb: rgba(49, 46, 43, 0.16);
    --chart-border: #FFFFFF;
    --accent-text-soft: #B35A00;
    --bg-overlay: rgba(255, 255, 255, 0.94);
    --shadow-md: 0 10px 15px -3px rgba(49, 46, 43, 0.06), 0 4px 6px -2px rgba(49, 46, 43, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(49, 46, 43, 0.08), 0 10px 10px -5px rgba(49, 46, 43, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    background-image: none;
    overflow-x: hidden;
}

html[data-theme="light"] body {
    background-image:
        radial-gradient(at 100% 0%, rgba(255, 135, 0, 0.04) 0px, transparent 42%);
}

/* Scrollbar Personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-strong);
}

/* ==========================================================================
   ESTILOS DE ACCESO (LOGIN)
   ========================================================================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: var(--bg-surface);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.brand-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--primary-gradient);
    border-radius: 18px;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(255, 135, 0, 0.3);
}

.brand-title {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(120deg, var(--text-primary), hsl(215, 20%, 80%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.brand-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   COMPONENTES DE FORMULARIO
   ========================================================================== */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-focus);
    box-shadow: 0 0 0 3px rgba(255, 135, 0, 0.15);
    background-color: var(--bg-surface-solid);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    padding: 0.9rem 1.5rem;
    color: white;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(255, 135, 0, 0.16);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 135, 0, 0.3);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.alert {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    animation: shake 0.5s ease-in-out;
}

.alert-success {
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

/* ==========================================================================
   DISEÑO DEL DASHBOARD (INDEX)
   ========================================================================== */
.app-container,
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-shell {
    width: 100%;
}

.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface-solid);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 120;
    transition: width 0.25s ease;
}

.app-shell.sidebar-collapsed .app-sidebar {
    width: 72px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.app-shell.sidebar-collapsed .sidebar-brand-text,
.app-shell.sidebar-collapsed .sidebar-nav-label {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.sidebar-nav-link i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-btn-secondary-hover);
}

.sidebar-nav-link.is-active {
    color: var(--accent-text-soft);
    background: var(--accent-bg-strong);
    border-color: var(--accent-border);
}

.sidebar-footer {
    padding: 0.5rem 0.5rem 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    flex-shrink: 0;
}

.sidebar-nav-bottom {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.35rem 0 0;
}

.sidebar-nav-settings.is-active {
    color: hsl(45, 90%, 80%);
    background: hsla(45, 90%, 50%, 0.12);
    border-color: hsla(45, 90%, 50%, 0.35);
}

.sidebar-nav-logout {
    margin-top: 0.15rem;
}

.sidebar-nav-logout:hover {
    color: hsl(350, 84%, 78%);
    background: hsla(350, 84%, 55%, 0.12);
    border-color: hsla(350, 84%, 55%, 0.25);
}

.app-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-overlay);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 110;
}

.topbar-spacer {
    flex: 1;
    min-width: 0;
}

.topbar-search {
    flex: 1 1 280px;
    max-width: 420px;
    min-width: 180px;
}

.topbar-search-input {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 0.88rem;
}

.global-search-dropdown {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 200;
    max-height: min(24rem, 60vh);
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-solid);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem 0;
}

.global-search-group__title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.global-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.global-search-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.55rem 0.85rem;
    text-decoration: none;
    color: inherit;
    border-left: 2px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.global-search-item:hover,
.global-search-item.is-active {
    background: var(--accent-bg);
    border-left-color: var(--accent-strong);
}

.global-search-item__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.global-search-item__subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-search-empty {
    margin: 0;
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.global-search-empty--error {
    color: hsl(350, 84%, 65%);
}

.global-search-spinner {
    animation: syncSpin 0.9s linear infinite;
    vertical-align: middle;
    margin-right: 0.35rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sidebar-toggle {
    padding: 0.55rem 0.75rem;
}

.btn-sync-topbar.is-loading,
.topbar-sync-actions .btn-secondary.is-loading {
    opacity: 0.75;
    pointer-events: none;
}

.topbar-sync-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.sync-btn-spin {
    animation: syncSpin 0.9s linear infinite;
}

@keyframes syncSpin {
    to {
        transform: rotate(360deg);
    }
}

.sync-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: hsla(225, 45%, 4%, 0.72);
    backdrop-filter: blur(4px);
}

.sync-overlay.is-hidden {
    display: none !important;
}

.sync-panel {
    width: min(440px, 100%);
    padding: 1.35rem 1.5rem 1.5rem;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: hsl(225, 32%, 10%);
    box-shadow: 0 20px 50px hsla(0, 0%, 0%, 0.45);
}

.sync-panel-spinner {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 2rem;
    color: var(--accent-icon);
}

.sync-panel-busy.is-hidden {
    display: none !important;
}

.sync-panel-spinner .ph {
    animation: syncSpin 0.9s linear infinite;
}

.sync-overlay-done .sync-panel-spinner .ph {
    animation: none;
}

.sync-panel-title {
    margin: 0 0 0.65rem;
    font-size: 1.05rem;
    text-align: center;
    color: var(--text-secondary);
}

.sync-panel-status {
    margin: 0 0 0.85rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    min-height: 1.25em;
    text-align: center;
}

.sync-progress-track {
    height: 6px;
    border-radius: 999px;
    background: hsla(220, 20%, 18%, 0.9);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.sync-progress-indeterminate .sync-progress-bar {
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-strong), var(--brand-orange-soft));
    animation: syncIndeterminate 1.15s ease-in-out infinite;
}

@keyframes syncIndeterminate {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(320%);
    }
}

.sync-panel-result {
    margin-top: 0;
    padding-top: 0;
}

.sync-panel-result.is-hidden {
    display: none !important;
}

.sync-panel-title-done {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 0 0.85rem;
    color: hsl(142, 55%, 72%);
}

.sync-panel-title-error {
    color: hsl(350, 84%, 72%);
}

.sync-panel-result .alert {
    margin-bottom: 0;
}

.sync-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.sync-result-actions .sync-result-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    pointer-events: auto;
    cursor: pointer;
}

.sync-result-actions .btn-primary.sync-result-btn {
    flex: 1 1 100%;
}

.sync-panel-result {
    position: relative;
    z-index: 2;
}

/* Header legacy (por si queda referencia) */
.app-header {
    background: var(--bg-overlay);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    color: inherit;
}

.header-logo {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-btn-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    color: var(--text-primary);
    text-decoration: none;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-secondary:hover {
    background-color: var(--bg-btn-secondary-hover);
    border-color: var(--text-secondary);
}

.btn-danger {
    background-color: hsla(350, 84%, 55%, 0.1);
    border: 1px solid hsla(350, 84%, 55%, 0.3);
    color: var(--color-danger);
}

.btn-danger:hover {
    background-color: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

/* Contenido Principal */
.main-content {
    flex: 1;
    padding: 2rem 2.5rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease-out;
}

/* Indicador de Modo Mock */
.mode-banner {
    background: linear-gradient(90deg, rgba(255, 135, 0, 0.15) 0%, rgba(255, 135, 0, 0.12) 100%);
    border: 1px solid rgba(255, 135, 0, 0.3);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.mode-banner-text strong {
    color: var(--accent-icon);
}

/* Rejilla de Métricas (Tarjetas de arriba) */
.metrics-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metrics-section {
    background: var(--bg-surface);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.25rem;
}

.metrics-section-billing {
    border-color: rgba(255, 135, 0, 0.25);
}

.metrics-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.metrics-secondary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.metrics-grid {
    display: grid;
    gap: 1rem;
}

.metrics-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics-section .metric-card {
    background: var(--bg-panel);
    box-shadow: none;
}

.metrics-section-billing .metric-card {
    padding: 1.25rem 1rem;
}

.metric-card {
    background: var(--bg-panel);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.1rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 135, 0, 0.4);
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    background: var(--accent-bg);
    color: var(--accent-icon);
}

.metric-card.style-purple .metric-icon {
    background: var(--accent-bg);
    color: var(--accent-icon);
}

.metric-card.style-blue .metric-icon {
    background: var(--accent-bg);
    color: var(--accent-secondary);
}

.metric-card.style-green .metric-icon {
    background: hsla(142, 76%, 45%, 0.1);
    color: hsl(142, 76%, 70%);
}

.metric-card.style-red .metric-icon {
    background: hsla(350, 84%, 55%, 0.1);
    color: hsl(350, 84%, 70%);
}

.metric-card.style-amber .metric-icon {
    background: hsla(38, 92%, 50%, 0.1);
    color: hsl(38, 92%, 70%);
}

.metric-card.style-indigo .metric-icon {
    background: rgba(107, 102, 94, 0.12);
    color: var(--accent-secondary);
}

.metric-info {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Permite truncar y flexibilizar el ancho */
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amount-eur {
    white-space: nowrap;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0.1rem;
    white-space: nowrap;
}

.metric-subvalue {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Grid de Gráficos e Insights */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

    .metrics-secondary {
        grid-template-columns: 1fr;
    }
}

/* Dashboard con pestañas */
.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dashboard-pulse {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: stretch;
    padding: 0.85rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-panel);
}

.dashboard-pulse-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    text-align: left;
}

.dashboard-pulse-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 135, 0, 0.45);
    box-shadow: 0 8px 24px rgba(255, 135, 0, 0.12);
}

.dashboard-pulse-chip__icon {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}

.dash-tone-amber {
    background: hsla(38, 92%, 50%, 0.16);
    color: hsl(38, 96%, 72%);
}

.dash-tone-violet {
    background: var(--accent-bg-strong);
    color: var(--accent-text-soft);
}

.dash-tone-mint {
    background: hsla(160, 65%, 48%, 0.16);
    color: hsl(160, 78%, 72%);
}

.dashboard-pulse-chip__body {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.dashboard-pulse-chip__body strong {
    font-size: 1.15rem;
    font-weight: 700;
}

.dashboard-pulse-chip__body span {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.dashboard-pulse-revenue {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.35rem 0.85rem;
    border-left: 1px solid var(--border-color);
    min-width: 160px;
}

.dashboard-pulse-revenue__label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dashboard-pulse-revenue strong {
    font-size: 1.05rem;
    color: hsl(160, 78%, 72%);
}

.dashboard-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.dashboard-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-panel);
    color: var(--text-secondary);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.18s ease;
    text-align: left;
}

.dashboard-tab::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-focus), var(--accent-focus));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.dashboard-tab:hover {
    color: var(--text-primary);
    border-color: rgba(255, 135, 0, 0.22);
}

.dashboard-tab.is-active {
    color: var(--text-primary);
    background: var(--bg-main);
    border-color: var(--accent-border);
    box-shadow: var(--shadow-sm);
}

.dashboard-tab.is-active::after {
    transform: scaleX(1);
}

.dashboard-tab .ph {
    font-size: 1.15rem;
    color: var(--accent-icon);
}

.dashboard-tab__label {
    font-size: 0.95rem;
    font-weight: 650;
}

.dashboard-tab__hint {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.dashboard-tab__badge {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: hsl(38, 92%, 50%);
    color: hsl(24, 90%, 12%);
    font-size: 0.72rem;
    font-weight: 800;
    display: grid;
    place-items: center;
}

.dashboard-panel {
    display: none;
    animation: dashPanelIn 0.28s ease;
}

.dashboard-panel.is-active {
    display: block;
}

@keyframes dashPanelIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-agenda-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.dashboard-agenda-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dashboard-agenda-sub {
    margin: 0.25rem 0 0;
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.dashboard-due-table td {
    vertical-align: middle;
}

.dash-due-title {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.dash-due-bar {
    display: block;
    height: 3px;
    border-radius: 999px;
    background: var(--border-color);
    position: relative;
    overflow: hidden;
}

.dash-due-bar::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--dash-urgency, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, hsl(160, 65%, 48%), hsl(38, 92%, 50%), hsl(0, 72%, 58%));
}

.dash-due-pill {
    display: inline-flex;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg-btn-secondary);
}

.dash-due-row.dash-urgency-past .dash-due-pill {
    background: hsla(0, 72%, 58%, 0.18);
    color: hsl(0, 85%, 78%);
}

.dash-due-row.dash-urgency-today .dash-due-pill,
.dash-due-row.dash-urgency-soon .dash-due-pill {
    background: hsla(38, 92%, 50%, 0.18);
    color: hsl(38, 96%, 72%);
}

.dash-due-row.dash-urgency-near .dash-due-pill {
    background: rgba(255, 135, 0, 0.15);
    color: var(--accent-text-soft);
}

@media (max-width: 900px) {
    .dashboard-tabs {
        grid-template-columns: 1fr;
    }

    .dashboard-pulse-revenue {
        margin-left: 0;
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding-top: 0.65rem;
        width: 100%;
    }
}

@media (min-width: 1100px) {
    .dashboard-agenda-grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

@media (max-width: 768px) {
    .metrics-grid-3,
    .metrics-grid-2 {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--bg-panel);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.8rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-container {
    position: relative;
    height: 320px;
    width: 100%;
}

/* Lista de clientes TOP */
.vip-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.vip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid hsla(220, 20%, 25%, 0.2);
}

.vip-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.vip-name {
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.vip-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.vip-amount {
    font-weight: 700;
    color: hsl(142, 76%, 45%);
    font-size: 1rem;
}

/* Secciones de Tablas */
.table-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-wrapper {
    position: relative;
    max-width: 320px;
    width: 100%;
}

.search-input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    padding-left: 2.2rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: all 0.25s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-focus);
    background-color: var(--bg-surface-solid);
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.table-premium {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    text-align: left;
}

.table-premium th {
    background-color: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Encabezados ordenables: etiqueta + icono siempre en la misma línea */
.table-premium th .th-sort-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    vertical-align: middle;
    max-width: 100%;
}

.table-premium th .th-sort-inner--end {
    justify-content: flex-end;
    width: 100%;
}

.table-premium th .th-sort-icon {
    flex-shrink: 0;
    font-size: 0.8rem;
    opacity: 0.6;
    line-height: 1;
}

.table-premium td {
    padding: 1rem;
    border-bottom: 1px solid var(--bg-btn-secondary);
    color: var(--text-primary);
}

.table-premium tbody tr {
    transition: background-color 0.2s ease;
}

.table-premium tbody tr:hover {
    background-color: hsla(220, 20%, 25%, 0.2);
}

.table-premium tbody tr:last-child td {
    border-bottom: none;
}

/* Badges / Etiquetas */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-paid {
    background-color: var(--color-success-bg);
    color: var(--color-success);
}

.badge-unpaid {
    background-color: var(--color-warning-bg);
    color: var(--color-warning);
}

.badge-overdue {
    background-color: var(--color-danger-bg);
    color: var(--color-danger);
}

.badge-cancelled {
    background-color: hsla(215, 12%, 48%, 0.22);
    color: var(--text-muted);
}

.badge-tag {
    background: var(--accent-bg);
    color: var(--accent-icon);
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: none;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
}

.facturacion-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: rgba(255, 135, 0, 0.08);
    border: 1px solid var(--accent-bg-strong);
}

.facturacion-total-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.facturacion-total-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.facturacion-total-value {
    font-size: 1.15rem;
    color: var(--accent-text-soft);
}

.facturacion-total-count .facturacion-total-value {
    font-size: 1rem;
}

.facturacion-totals-with-commission {
    justify-content: space-between;
    align-items: center;
    gap: 1rem 1.5rem;
}

.facturacion-totals-left {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
}

.facturacion-total-neto {
    padding: 0.25rem 0;
}

.facturacion-total-commission-hero {
    margin-left: auto;
}

.facturacion-total-commission-hero .facturacion-total-label {
    color: hsl(142, 65%, 72%);
    font-weight: 600;
}

.facturacion-total-commission-hero .commission-value-lg {
    font-size: 1.15rem;
    padding: 0.12rem 0.45rem;
}

.facturacion-total-commission-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem 0.65rem;
}

.commission-breakdown-inline {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-service {
    background-color: rgba(255, 135, 0, 0.15);
    color: var(--accent-icon);
    border: 1px solid rgba(255, 135, 0, 0.2);
}

/* Pie de página */
.app-footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ==========================================================================
   ELEMENTOS DE FILTRADO Y MÉTRICAS AMPLIADAS (AÑADIDOS)
   ========================================================================== */
.period-selector-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    transition: all 0.25s ease;
}

.period-selector-wrapper:hover {
    border-color: var(--accent-focus);
    background-color: var(--bg-surface-solid);
}

.period-selector-wrapper i {
    color: var(--accent-icon);
    font-size: 1.1rem;
}

.period-selector-wrapper select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    padding-right: 0.5rem;
}

.period-selector-wrapper select option {
    background-color: var(--bg-surface-solid);
    color: var(--text-primary);
}

.table-filters-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.status-selector-wrapper {
    min-width: 150px;
}

.section-filters {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.section-filters-inline .section-filters-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-button-group-period {
    flex: 1;
    min-width: 0;
}

.invoice-status-select {
    flex-shrink: 0;
    margin-left: auto;
}

.invoice-status-select-input {
    min-width: 168px;
    font-size: 0.82rem;
    padding: 0.42rem 0.65rem;
    height: auto;
}

.invoice-source-select-wrapper {
    flex-shrink: 0;
}

.invoice-source-select-input {
    min-width: 190px;
    font-size: 0.82rem;
    padding: 0.42rem 0.65rem;
    height: auto;
}

.period-year-select-wrapper {
    flex-shrink: 0;
}

.period-year-select-input {
    min-width: 132px;
    font-size: 0.82rem;
    padding: 0.42rem 0.65rem;
    height: auto;
}

.badge-legacy-invoice {
    display: inline-block;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    background: var(--surface-elevated, #eef2f7);
    color: var(--text-secondary, #5c6570);
    border: 1px solid var(--border-color, #d8dee6);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
}

.table-row-legacy td {
    background: rgba(99, 102, 241, 0.03);
}

.invoice-unlinked-contact {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted, #9a3412);
    background: rgba(234, 88, 12, 0.08);
    border: 1px dashed rgba(234, 88, 12, 0.35);
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
}

.col-invoice-contact .table-entity-link {
    font-weight: 500;
}

.legacy-import-card {
    margin-bottom: 1rem;
}

.legacy-import-summary {
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    list-style: none;
    padding: 0.25rem 0;
}

.legacy-import-summary::-webkit-details-marker {
    display: none;
}

.legacy-import-meta {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted, #6b7280);
}

.legacy-import-body {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.legacy-import-intro {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #4b5563);
    line-height: 1.5;
}

.legacy-import-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.legacy-import-file {
    flex: 1;
    min-width: 220px;
    max-width: 420px;
}

.section-filters-dashboard {
    margin-bottom: 1.5rem;
}

.filter-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-button-group-status {
    margin-top: 0.15rem;
}

.tag-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.65rem 1rem;
}

.tag-filter-bar-main {
    flex: 1 1 320px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    min-width: 0;
}

.tag-filter-tags {
    flex: 1 1 auto;
    min-width: 0;
}

.tag-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-left: auto;
    flex-shrink: 0;
}

.tag-filter-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 0.45rem;
    flex-shrink: 0;
}

.filter-button-group-tags {
    margin-top: 0;
}

.tag-filter-preset {
    font-weight: 600;
    border-style: dashed;
}

.tag-filter-preset.is-active {
    color: hsl(142, 76%, 80%);
    background: hsla(142, 76%, 45%, 0.14);
    border-color: hsla(142, 76%, 45%, 0.5);
    border-style: solid;
}

.tag-filter-btn.is-active {
    color: var(--accent-text-soft);
    background: var(--accent-bg-strong);
    border-color: var(--accent-border);
}

.tag-filter-clear {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid hsla(350, 84%, 55%, 0.35);
    border-radius: 8px;
    background: hsla(350, 84%, 55%, 0.08);
    color: hsl(350, 84%, 78%);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tag-filter-clear:hover {
    color: hsl(350, 84%, 88%);
    background: hsla(350, 84%, 55%, 0.16);
    border-color: hsla(350, 84%, 55%, 0.55);
}

.tag-filter-clear i {
    font-size: 0.9rem;
}

.tag-filter-empty {
    font-size: 0.85rem;
    margin: 0;
}

.tag-filter-dropdown {
    position: relative;
    flex-shrink: 0;
}

.tag-filter-trigger {
    min-width: 10rem;
    justify-content: space-between;
}

.tag-filter-trigger-caret {
    font-size: 0.85rem;
    opacity: 0.7;
}

.tag-filter-dropdown.is-open .tag-filter-trigger-caret {
    transform: rotate(180deg);
}

.tag-filter-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 200;
    min-width: 280px;
    max-width: min(420px, 92vw);
    max-height: 320px;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 40px hsla(0, 0%, 0%, 0.45);
}

.tag-filter-panel[hidden] {
    display: none !important;
}

.tag-filter-panel-head {
    padding: 0.65rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.tag-filter-checklist {
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.tag-filter-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.tag-filter-check:hover {
    background: var(--bg-btn-secondary-hover);
}

.tag-filter-check input {
    accent-color: var(--accent-strong);
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.tag-filter-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid var(--border-color);
}

.settings-card {
    max-width: 720px;
}

.settings-card-wide {
    max-width: 920px;
}

.comisionistas-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comisionista-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-btn-secondary);
    overflow: hidden;
}

.comisionista-card-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    width: 100%;
    padding: 0.85rem 1.1rem;
    list-style: none;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.comisionista-card-summary::-webkit-details-marker {
    display: none;
}

.comisionista-card-summary::marker {
    content: '';
}

.comisionista-card-summary:hover {
    background: rgba(255, 135, 0, 0.06);
}

.comisionista-toggle-leading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 0 1 auto;
}

.comisionista-toggle-icon {
    flex-shrink: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.comisionista-card[open] .comisionista-toggle-icon {
    transform: rotate(180deg);
}

.comisionista-toggle-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comisionista-toggle-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: right;
    line-height: 1.35;
    flex: 1 1 40%;
    min-width: 0;
}

.comisionista-card-body {
    border-top: 1px solid var(--border-color);
}

.comisionista-card-body-inner {
    padding: 1rem 1.1rem 1.1rem;
}

.comisionista-card-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid hsla(220, 20%, 22%, 0.6);
}

.comisionista-remove {
    color: var(--color-danger);
    border-color: hsla(350, 84%, 55%, 0.35);
}

.comisionista-remove:hover {
    background: hsla(350, 84%, 55%, 0.12);
}

@media (max-width: 640px) {
    .comisionista-card-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .comisionista-toggle-meta {
        text-align: left;
        padding-left: 1.4rem;
        width: 100%;
    }
}

.facturacion-totals-commission-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.commission-breakdown {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 220px;
}

.commission-breakdown li {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem 0.75rem;
    align-items: center;
    font-size: 0.85rem;
}

.commission-breakdown-name {
    color: var(--text-primary);
    font-weight: 500;
}

.commission-breakdown-meta {
    color: var(--text-muted);
}

.commission-breakdown-amount {
    color: hsl(142, 76%, 72%);
    font-weight: 600;
}

.commission-breakdown-single {
    margin: 0;
    font-size: 0.82rem;
    text-align: right;
    max-width: 280px;
}

.concept-filter-bar {
    width: 100%;
}

.concept-filter-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.concept-filter-mode {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.concept-filter-panel:not(.is-hidden) {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 1 auto;
    min-width: 0;
}

.concept-filter-panel--inline:not(.is-hidden) {
    flex: 1 1 220px;
    max-width: 100%;
}

.concept-filter-panel[data-concept-filter-tags]:not(.is-hidden) .tag-filter-group {
    width: auto;
    max-width: 100%;
}

.concept-filter-panel[data-concept-filter-tags]:not(.is-hidden) .tag-filter-bar {
    justify-content: flex-start;
}

.concept-filter-comisionista-btn.is-active,
.concept-filter-mode-btn.is-active {
    color: var(--accent-text-soft);
    background: var(--accent-bg-strong);
    border-color: var(--accent-border);
}

.concept-filter-panel.is-hidden {
    display: none !important;
}

.settings-section {
    margin-bottom: 1.75rem;
}

.settings-section-muted {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.settings-subtitle {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.settings-hint {
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
}

.settings-form-actions {
    padding-top: 0.5rem;
}

.form-hint {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.concept-cell-col {
    min-width: 180px;
    max-width: 320px;
}

.concept-cell {
    display: flex;
    flex-direction: column;
}

.concept-cell-text {
    font-size: 0.78rem;
    line-height: 1.35;
    font-weight: 400;
    color: var(--text-primary);
    white-space: normal;
}

.facturacion-subnav {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.35rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-btn-secondary);
    width: fit-content;
}

.facturacion-subnav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.95rem;
    border-radius: 7px;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.facturacion-subnav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 135, 0, 0.08);
}

.facturacion-subnav-link.is-active {
    color: var(--accent-text-soft);
    background: rgba(255, 135, 0, 0.2);
    border: 1px solid var(--accent-border);
}

/* Subnavegación de sección (facturación, suscripciones, …) */
.section-subnav {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    padding: 0.35rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-btn-secondary);
    width: fit-content;
    max-width: 100%;
    flex-wrap: wrap;
}

.section-subnav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.95rem;
    border-radius: 7px;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.section-subnav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 135, 0, 0.08);
}

.section-subnav-link.is-active {
    color: var(--accent-text-soft);
    background: rgba(255, 135, 0, 0.2);
    border: 1px solid var(--accent-border);
}

.subs-subnav-link.is-active {
    color: hsl(160, 78%, 82%);
    background: hsla(160, 65%, 48%, 0.18);
    border: 1px solid hsla(160, 65%, 48%, 0.35);
}

.subs-subnav-link:hover {
    background: hsla(160, 65%, 48%, 0.1);
}

.subs-listado-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    margin-bottom: 1.25rem;
    padding: 0.9rem 1.1rem;
}

.subs-listado-summary__item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
}

.subs-listado-summary__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    width: 100%;
}

.subs-listado-summary__item strong {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.subs-listado-summary__hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.subs-listado-summary__mrr {
    color: hsl(160, 78%, 72%) !important;
}

.subs-listado-summary .btn-sm {
    margin-left: auto;
}

.subs-hero-actions {
    display: flex;
    align-items: center;
    justify-self: end;
}

.filter-btn {
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface-elevated);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 135, 0, 0.4);
}

a.filter-btn {
    display: inline-block;
    text-decoration: none;
    line-height: 1.35;
}

a.filter-btn:hover {
    text-decoration: none;
}

.filter-btn.is-active {
    color: var(--accent-text-soft);
    background: var(--accent-bg-strong);
    border-color: var(--accent-border);
}

.holded-id-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-copy-id,
.btn-holded-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1;
}

.btn-copy-id:hover,
.btn-holded-link:hover {
    color: var(--accent-text-soft);
    border-color: var(--accent-border);
    background: var(--accent-bg);
}

.btn-copy-id.is-copied {
    color: hsl(142, 76%, 65%);
    border-color: hsla(142, 76%, 45%, 0.45);
}

.col-copy-id {
    width: 72px;
    text-align: center;
}

.col-amount {
    text-align: right;
    white-space: nowrap;
}

.col-amount-strong {
    font-weight: 600;
}

.col-amount-success {
    color: var(--color-success);
    font-weight: 700;
}

.amount-positive {
    color: var(--color-success);
}

.amount-negative {
    color: hsl(0, 65%, 58%);
}

.commission-value {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 6px;
    background: transparent;
    border: 1px solid hsla(142, 72%, 48%, 0.5);
    font-weight: 700;
    font-size: 0.95rem;
    color: hsl(142, 78%, 82%);
}

.commission-value .amount-eur {
    color: inherit;
}

.commission-value-lg {
    font-size: 1.15rem;
    padding: 0.12rem 0.45rem;
    border-radius: 6px;
}

.metric-subvalue {
    font-size: 0.82rem;
    color: var(--text-secondary);
    opacity: 0.85;
    font-weight: 500;
    margin-top: 0.2rem;
    border-top: 1px dashed hsla(220, 20%, 30%, 0.4);
    padding-top: 0.2rem;
}

/* ==========================================================================
   INTERFAZ DE REDACCIÓN DE EMAIL (COMPOSER MODAL)
   ========================================================================== */
.contact-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-strong);
    cursor: pointer;
    vertical-align: middle;
}

.floating-composer-trigger {
    position: fixed;
    bottom: 2.5rem;
    right: 2.5rem;
    background: var(--primary-gradient);
    border: none;
    border-radius: 50px;
    color: white;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    box-shadow: 0 10px 30px var(--accent-border);
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-composer-trigger:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 35px var(--accent-shadow);
}

.floating-composer-trigger:active {
    transform: translateY(-1px);
}

/* Modal Estilo Glassmorphism Premium */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(6, 8, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 650px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.9);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    background-image: var(--primary-gradient);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.25s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--accent-focus);
    box-shadow: 0 0 15px rgba(255, 135, 0, 0.15);
    background-color: var(--bg-surface-solid);
}

.form-textarea {
    resize: vertical;
    min-height: 150px;
}

.recipient-pill-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    max-height: 120px;
    overflow-y: auto;
}

.recipient-pill {
    background-color: rgba(255, 135, 0, 0.15);
    border: 1px solid rgba(255, 135, 0, 0.3);
    border-radius: 8px;
    padding: 0.25rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent-text-soft);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Estado de carga */
.sending-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 15, 30, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.sending-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 92, 246, 0.15);
    border-top: 4px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

.sending-status-log {
    width: 100%;
    max-width: 450px;
    max-height: 150px;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    text-align: left;
}

.sending-status-line {
    margin-bottom: 0.35rem;
}

.sending-status-line.success { color: var(--color-success); }
.sending-status-line.error { color: var(--color-danger); }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 0.8; }
    70% { transform: scale(0.9); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}


/* Autocomplete de Contactos en el Modal */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: hsl(220, 25%, 12%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55);
}

.autocomplete-suggestion {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid hsla(0, 0%, 100%, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transition: background-color 0.2s ease;
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

.autocomplete-suggestion:hover {
    background-color: rgba(255, 135, 0, 0.2);
}

.suggestion-name {
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
}

.suggestion-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
}

.suggestion-email {
    color: var(--accent-text-soft);
}

/* ==========================================================================
   NAVEGACIÓN Y PÁGINAS INTERNAS
   ========================================================================== */
.app-nav {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.app-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.62rem 1.05rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.96rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.app-nav-link i {
    font-size: 1.15rem;
}

.app-nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-btn-secondary-hover);
}

.app-nav-link.is-active {
    color: var(--accent-text-soft);
    background: var(--accent-bg-strong);
    border-color: var(--accent-border);
}

.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-secondary.is-active {
    background-color: rgba(255, 135, 0, 0.2);
    border-color: var(--accent-strong);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-icon {
    background: var(--bg-btn-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-icon-muted {
    opacity: 0.7;
}

.inline-actions {
    display: flex;
    gap: 0.25rem;
}

.tab-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

.chart-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-align: center;
}

.empty-state-cell,
.empty-state-inline {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.text-muted {
    color: var(--text-muted);
}

/* Kanban */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.kanban-column {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    min-height: 320px;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.kanban-column-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.kanban-count {
    background: rgba(255, 135, 0, 0.15);
    color: var(--accent-text-soft);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 200px;
}

.kanban-cards.is-drag-over {
    background: rgba(255, 135, 0, 0.06);
    border-radius: 12px;
}

.kanban-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem;
    cursor: grab;
}

.kanban-card.is-dragging {
    opacity: 0.5;
}

.kanban-card.is-overdue {
    border-color: hsla(350, 84%, 55%, 0.5);
}

.kanban-card.is-due-soon {
    border-color: hsla(38, 92%, 50%, 0.45);
}

.kanban-card-title {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 0.5rem;
}

.kanban-card-project {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.kanban-card-dates {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.kanban-card-actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.badge-task-pendiente { background: rgba(255, 135, 0, 0.12); color: var(--accent-icon); }
.badge-task-en_curso { background: hsla(38, 92%, 50%, 0.15); color: hsl(38, 92%, 70%); }
.badge-task-hecho { background: hsla(142, 76%, 45%, 0.15); color: hsl(142, 76%, 70%); }
.badge-task-archivado { background: hsla(215, 12%, 48%, 0.2); color: var(--text-muted); }

/* Entity search */
.entity-search {
    position: relative;
}

.entity-search-pill-box {
    margin-bottom: 0.5rem;
    min-height: 28px;
}

.entity-search-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.entity-search-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 135, 0, 0.15);
    border: 1px solid var(--accent-border);
    color: var(--accent-text-soft);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

.entity-search-clear {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    opacity: 0.75;
}

.entity-search-clear:hover {
    opacity: 1;
}

.entity-search-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 50;
}

.modal-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.view-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
}

.view-banner-archived {
    background: hsla(215, 12%, 48%, 0.15);
    border: 1px solid hsla(215, 12%, 48%, 0.35);
    color: var(--text-secondary);
}

.floating-fab-projects {
    background: linear-gradient(135deg, var(--brand-orange-deep) 0%, var(--accent-strong) 100%);
    box-shadow: 0 10px 30px rgba(255, 135, 0, 0.28);
}

.floating-fab-tasks {
    background: linear-gradient(135deg, hsl(142, 76%, 45%) 0%, hsl(160, 70%, 40%) 100%);
    box-shadow: 0 10px 30px hsla(142, 76%, 45%, 0.35);
}

.is-clickable {
    cursor: pointer;
    transition: background 0.15s ease;
}

tr.is-clickable:hover {
    background: rgba(255, 135, 0, 0.06);
}

.kanban-card.is-clickable {
    cursor: grab;
}

.kanban-card.is-clickable:hover {
    border-color: var(--accent-border);
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.deadline-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.deadline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-btn-secondary);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.deadline-item:hover {
    border-color: rgba(255, 135, 0, 0.4);
    transform: translateY(-1px);
}

.deadline-item.deadline-overdue {
    border-color: hsla(350, 84%, 55%, 0.45);
}

.deadline-item.deadline-today,
.deadline-item.deadline-soon {
    border-color: hsla(38, 92%, 50%, 0.45);
}

.deadline-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: block;
}

.deadline-item-project {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.2rem;
}

.deadline-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}

.deadline-item-date {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.deadline-overdue .deadline-item-date {
    color: hsl(350, 84%, 65%);
}

.deadline-today .deadline-item-date,
.deadline-soon .deadline-item-date {
    color: hsl(38, 92%, 65%);
}

/* Flatpickr tema oscuro */
.flatpickr-calendar {
    background: hsl(223, 33%, 12%);
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekdays,
.flatpickr-weekday {
    background: hsl(223, 33%, 12%);
    color: var(--text-primary);
}

.flatpickr-day {
    color: var(--text-secondary);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.flatpickr-day:hover {
    background: rgba(255, 135, 0, 0.2);
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    fill: var(--text-primary);
}

input.flatpickr-input.form-input,
input.flatpickr-input.search-input {
    cursor: pointer;
}

.modal-container-wide {
    max-width: 920px;
    width: 95%;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ficha-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.ficha-section-full {
    grid-column: 1 / -1;
}

.ficha-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.1rem;
}

.ficha-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}

.ficha-kv {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid hsla(220, 20%, 25%, 0.25);
    font-size: 0.9rem;
}

.ficha-kv span {
    color: var(--text-muted);
}

.ficha-kv a {
    color: var(--accent-text-soft);
}

.ficha-desc {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.ficha-tasks-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.ficha-tasks-col h4 {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ficha-count {
    background: rgba(255, 135, 0, 0.15);
    color: var(--accent-text-soft);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    font-size: 0.72rem;
}

.ficha-task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.ficha-task-list li {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
}

.ficha-task-title {
    display: block;
    font-weight: 500;
}

.ficha-task-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ficha-task-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

.badge-phase {
    background: var(--accent-bg);
    color: var(--accent-icon);
}

.badge-phase-cancelled {
    background: hsla(0, 70%, 50%, 0.15);
    color: hsl(0, 70%, 70%);
}

.badge-estimate-sent { background: rgba(255, 135, 0, 0.12); color: var(--accent-icon); }
.badge-estimate-accepted { background: hsla(142, 76%, 45%, 0.15); color: hsl(142, 76%, 70%); }
.badge-estimate-rejected { background: hsla(0, 70%, 50%, 0.12); color: hsl(0, 70%, 68%); }
.badge-estimate-draft { background: hsla(215, 12%, 48%, 0.2); color: var(--text-muted); }

.phase-stepper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.phase-step {
    font-size: 0.68rem;
    padding: 0.35rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--surface-elevated);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.phase-step.is-done {
    border-color: hsla(142, 76%, 45%, 0.4);
    color: hsl(142, 76%, 65%);
}

.phase-step.is-current {
    background: var(--accent-bg-strong);
    border-color: var(--accent-focus);
    color: var(--accent-text-soft);
    font-weight: 600;
}

.phase-step:hover {
    border-color: var(--accent-focus);
}

.phase-stepper-cancelled {
    margin-bottom: 0.5rem;
}

.ficha-phase-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.ficha-budget-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ficha-budget-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface-elevated);
}

.ficha-budget-row.is-accepted {
    border-color: hsla(142, 76%, 45%, 0.45);
}

.ficha-budget-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.ficha-budget-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.ficha-budget-link {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ficha-budget-link .form-select {
    flex: 1;
}

.drive-payload-textarea {
    width: 100%;
    margin: 0.75rem 0 1rem;
    padding: 0.75rem 1rem;
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    box-sizing: border-box;
}

.ficha-meeting-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ficha-meeting-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.ficha-meeting-list li:last-child {
    border-bottom: none;
}

.link-muted {
    color: var(--accent-icon);
    text-decoration: none;
}

.link-muted:hover {
    text-decoration: underline;
}

.backup-card {
    margin-bottom: 1.5rem;
}

.backup-header {
    margin-bottom: 1.25rem;
}

.backup-intro {
    margin: 0.5rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 720px;
}

.backup-intro code {
    font-size: 0.85em;
    color: var(--text-primary);
}

.backup-create-form {
    padding-top: 0.25rem;
}

.backup-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

.backup-create-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.backup-label-input {
    flex: 1 1 260px;
    max-width: 100%;
}

.backup-create-btn {
    white-space: nowrap;
}

.backup-hint {
    margin: 0.65rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.backup-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.backup-size-cell {
    min-width: 220px;
}

.backup-size-line {
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.backup-size-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.backup-actions {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 0.5rem;
    text-align: right;
}

.backup-delete-form {
    display: inline;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid hsla(350, 84%, 55%, 0.35);
    color: var(--color-danger);
}

.btn-danger-outline:hover {
    background: hsla(350, 84%, 55%, 0.12);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.backup-restore-details {
    position: relative;
}

.backup-restore-toggle {
    list-style: none;
    cursor: pointer;
}

.backup-restore-toggle::-webkit-details-marker {
    display: none;
}

.backup-restore-form {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 20;
    width: min(320px, 85vw);
    padding: 0.85rem;
    border-radius: 10px;
    background: hsl(223, 24%, 12%);
    border: 1px solid hsla(350, 84%, 55%, 0.35);
    box-shadow: 0 12px 32px hsla(0, 0%, 0%, 0.35);
}

.backup-restore-warning {
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.backup-restore-form .search-input {
    width: 100%;
    margin-bottom: 0.65rem;
}

.backup-restore-btn {
    width: 100%;
    justify-content: center;
}

/* ——— Suscripciones (Panel FC) ——— */
.subs-wp-banner {
    border-color: rgba(255, 135, 0, 0.18);
    background: rgba(255, 135, 0, 0.08);
}

.subs-hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    gap: 1.25rem 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.35rem 1.5rem;
    border-radius: 14px;
    background: linear-gradient(135deg, hsla(160, 70%, 42%, 0.14) 0%, var(--accent-bg) 55%, var(--bg-panel) 100%);
    border: 1px solid hsla(160, 65%, 48%, 0.28);
    box-shadow: 0 8px 32px hsla(160, 60%, 30%, 0.08);
}

.subs-hero-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: hsl(160, 55%, 72%);
    font-weight: 600;
}

.subs-hero-mrr {
    font-size: 2.35rem;
    font-weight: 700;
    line-height: 1.15;
    color: hsl(160, 78%, 82%);
    margin: 0.15rem 0 0.25rem;
}

.subs-hero-sub {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.subs-hero-label-muted {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.subs-hero-hint {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    max-width: 480px;
}

.subs-hero-hint code {
    font-size: 0.72rem;
}

.subs-hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
}

.subs-stat-card {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: var(--bg-panel);
    border: 1px solid hsla(220, 20%, 30%, 0.45);
}

.subs-stat-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.subs-stat-value {
    font-size: 1.35rem;
    color: var(--text-primary);
}

.subs-stat-active {
    color: hsl(160, 76%, 72%);
}

.subs-stat-warn {
    color: hsl(38, 92%, 68%);
}

.subs-sync-form {
    justify-self: end;
}

.subs-sync-btn {
    white-space: nowrap;
}

.subs-radar {
    margin-bottom: 1.5rem;
}

.subs-radar-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.subs-radar-title i {
    color: hsl(38, 92%, 62%);
}

.subs-radar-hint {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted);
}

.subs-radar-track {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.subs-radar-item {
    flex: 1 1 160px;
    max-width: 260px;
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid hsla(220, 20%, 30%, 0.5);
    background: var(--bg-panel);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.subs-radar-item:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 135, 0, 0.4);
}

.subs-radar-urgent {
    border-color: hsla(38, 92%, 50%, 0.45);
    background: hsla(38, 92%, 50%, 0.08);
}

.subs-radar-soon {
    border-color: rgba(255, 135, 0, 0.28);
}

.subs-radar-days {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    background: hsla(220, 20%, 25%, 0.6);
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.subs-radar-urgent .subs-radar-days {
    background: hsla(38, 92%, 50%, 0.25);
    color: hsl(38, 92%, 78%);
}

.subs-radar-client {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.subs-radar-service,
.subs-radar-info {
    display: block;
    font-size: 0.76rem;
    line-height: 1.35;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subs-radar-service {
    margin-top: 0.15rem;
}

.subs-radar-info {
    color: var(--text-muted);
}

.subs-radar-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    padding-top: 0.3rem;
    border-top: 1px solid hsla(220, 20%, 30%, 0.35);
}

.subs-filters {
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.subs-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.subs-filter-group + .subs-filter-group {
    margin-top: 0;
    padding-top: 0.75rem;
    border-top: 1px solid hsla(220, 20%, 30%, 0.35);
}

.subs-filter-heading {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0;
    flex: 0 0 auto;
    min-width: 3.25rem;
}

.subs-client-cell {
    font-weight: 600;
}

.subs-service-cell {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.subs-domain-cell {
    font-size: 0.85rem;
    color: var(--accent-icon);
}

.subs-renewal-cell {
    white-space: nowrap;
}

.subs-renewal-date {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.subs-renewal-pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.subs-renewal-urgent {
    background: hsla(38, 92%, 50%, 0.2);
    color: hsl(38, 92%, 78%);
    border: 1px solid hsla(38, 92%, 50%, 0.35);
}

.subs-renewal-soon {
    background: rgba(255, 135, 0, 0.12);
    color: var(--accent-icon);
}

.subs-renewal-ok {
    background: hsla(142, 76%, 45%, 0.12);
    color: hsl(142, 76%, 72%);
}

.subs-renewal-past {
    background: hsla(0, 70%, 50%, 0.12);
    color: hsl(0, 70%, 72%);
}

.subs-renewal-none {
    color: var(--text-muted);
}

.subs-no-renew {
    margin-left: 0.35rem;
    color: hsl(0, 70%, 68%);
    vertical-align: middle;
}

.badge-subs-activo {
    background: hsla(142, 76%, 45%, 0.15);
    color: hsl(142, 76%, 72%);
    border: 1px solid hsla(142, 76%, 45%, 0.25);
}

.badge-subs-cancelado {
    background: hsla(215, 12%, 48%, 0.2);
    color: var(--text-muted);
}

.badge-subs-pausado {
    background: hsla(38, 92%, 50%, 0.12);
    color: hsl(38, 92%, 70%);
}

.subs-row-past {
    box-shadow: inset 3px 0 0 hsl(0, 72%, 52%);
}

.subs-row-urgent {
    box-shadow: inset 3px 0 0 hsl(38, 92%, 55%);
}

.subs-row-soon {
    box-shadow: inset 3px 0 0 var(--accent-focus);
}

.subs-row-inactive {
    opacity: 0.62;
}

.subs-row-inactive .subs-client-cell {
    font-weight: 500;
}

.subs-hero-mom {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.subs-hero-mom.is-up {
    background: hsla(160, 70%, 42%, 0.18);
    color: hsl(160, 78%, 72%);
    border: 1px solid hsla(160, 65%, 48%, 0.35);
}

.subs-hero-mom.is-down {
    background: hsla(0, 72%, 52%, 0.12);
    color: hsl(0, 78%, 72%);
    border: 1px solid hsla(0, 72%, 52%, 0.3);
}

/* ——— Pulso MRR (histórico mensual) ——— */
.mrr-pulse {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid hsla(160, 65%, 48%, 0.22);
    background: linear-gradient(145deg, var(--bg-panel) 0%, hsla(160, 40%, 14%, 0.35) 100%);
}

.mrr-pulse__aurora {
    position: absolute;
    inset: -40% -20%;
    background:
        radial-gradient(ellipse 50% 40% at 15% 20%, hsla(160, 80%, 45%, 0.18), transparent 55%),
        radial-gradient(ellipse 40% 35% at 85% 70%, var(--accent-bg), transparent 50%);
    pointer-events: none;
    animation: mrr-aurora 12s ease-in-out infinite alternate;
}

@keyframes mrr-aurora {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(2%, -3%) scale(1.05); }
}

.mrr-pulse__header {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.mrr-pulse__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.15rem;
    color: hsl(160, 78%, 82%);
}

.mrr-pulse__title i {
    color: hsl(160, 70%, 55%);
}

.mrr-pulse__subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.mrr-pulse__updated {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.mrr-pulse__body {
    position: relative;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.25rem;
    align-items: stretch;
}

.mrr-pulse__chart-wrap {
    height: 280px;
    min-height: 220px;
}

.mrr-pulse__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
}

.mrr-pulse__empty i {
    font-size: 2.5rem;
    color: hsl(160, 55%, 50%);
    margin-bottom: 0.75rem;
}

.mrr-pulse__empty-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.mrr-pulse__insights {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.mrr-insight {
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid hsla(220, 20%, 28%, 0.5);
}

.mrr-insight__label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.mrr-insight__value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mrr-insight__pct {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.mrr-insight.is-up .mrr-insight__value,
.mrr-insight.is-up .mrr-insight__pct {
    color: hsl(160, 76%, 72%);
}

.mrr-insight.is-down .mrr-insight__value,
.mrr-insight.is-down .mrr-insight__pct {
    color: hsl(0, 78%, 72%);
}

.mrr-insight--record {
    border-color: hsla(45, 92%, 55%, 0.35);
    background: hsla(45, 92%, 50%, 0.08);
}

.mrr-insight--record .mrr-insight__value {
    color: hsl(45, 92%, 72%);
}

.mrr-insight--streak {
    border-color: hsla(24, 95%, 55%, 0.35);
    background: hsla(24, 95%, 50%, 0.08);
}

.mrr-insight--streak .mrr-insight__value {
    color: hsl(24, 92%, 72%);
}

.mrr-insight--forecast {
    border-color: rgba(255, 135, 0, 0.3);
    background: rgba(255, 135, 0, 0.08);
}

.mrr-timeline {
    position: relative;
    display: flex;
    gap: 0.65rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid hsla(220, 20%, 28%, 0.45);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.mrr-timeline__month {
    flex: 0 0 auto;
    min-width: 118px;
    scroll-snap-align: start;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid hsla(220, 20%, 28%, 0.45);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.mrr-timeline__month:hover {
    transform: translateY(-2px);
}

.mrr-timeline__month.is-current {
    border-color: hsla(160, 65%, 48%, 0.55);
    box-shadow: 0 0 24px hsla(160, 60%, 40%, 0.15);
}

.mrr-timeline__month.is-up .mrr-timeline__delta {
    color: hsl(160, 76%, 72%);
}

.mrr-timeline__month.is-down .mrr-timeline__delta {
    color: hsl(0, 78%, 72%);
}

.mrr-timeline__label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mrr-timeline__mrr {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    margin: 0.2rem 0;
    color: hsl(160, 78%, 82%);
}

.mrr-timeline__delta {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
}

.mrr-timeline__delta--na {
    color: var(--text-muted);
    font-weight: 500;
}

.mrr-timeline__subs {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

@media (max-width: 1024px) {
    .mrr-pulse__body {
        grid-template-columns: 1fr;
    }

    .mrr-pulse__chart-wrap {
        height: 240px;
    }
}

@media (max-width: 1024px) {
    .subs-hero {
        grid-template-columns: 1fr;
    }

    .subs-sync-form {
        justify-self: start;
    }
}

@media (max-width: 1024px) {
    .ficha-grid,
    .ficha-tasks-grid {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(280px, 88vw);
        height: 100vh;
        height: 100dvh;
        z-index: 130;
        transform: translateX(0);
        transition: transform 0.25s ease;
        box-shadow: 8px 0 24px hsla(0, 0%, 0%, 0.35);
    }

    .app-shell.sidebar-collapsed .app-sidebar {
        transform: translateX(-100%);
        width: min(280px, 88vw);
    }

    .app-shell.sidebar-collapsed .sidebar-brand-text,
    .app-shell.sidebar-collapsed .sidebar-nav-label {
        display: inline;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 125;
        border: none;
        padding: 0;
        margin: 0;
        background: rgba(4, 6, 18, 0.62);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        cursor: pointer;
    }

    body.sidebar-mobile-open {
        overflow: hidden;
    }

    .app-body {
        width: 100%;
        min-width: 0;
    }

    .app-topbar {
        padding: 0.65rem 0.85rem;
        gap: 0.5rem;
    }

    .topbar-btn-label {
        display: none;
    }

    .topbar-search {
        max-width: none;
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar-sync-actions .btn-secondary {
        padding: 0.5rem 0.65rem;
    }

    .main-content {
        padding: 1rem;
    }

    .card {
        padding: 1.1rem;
        border-radius: 14px;
    }

    .page-toolbar,
    .entity-page-toolbar {
        flex-wrap: wrap;
        gap: 0.65rem;
    }

    .entity-page-title {
        font-size: 1.15rem;
    }

    .table-section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper {
        max-width: none;
    }

    .facturacion-totals-with-commission {
        flex-direction: column;
        align-items: stretch;
    }

    .facturacion-totals-commission-block,
    .facturacion-totals-left {
        align-items: stretch;
        width: 100%;
    }

    .facturacion-total-commission-row {
        justify-content: flex-start;
    }

    .mode-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .contact-ficha-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .contact-ficha-tab {
        flex-shrink: 0;
    }
}

@media (max-width: 640px) {
    .login-container {
        padding: 1rem;
    }

    .login-card {
        padding: 1.75rem 1.25rem;
        border-radius: 18px;
    }

    .table-premium {
        font-size: 0.84rem;
    }

    .table-premium th,
    .table-premium td {
        padding: 0.65rem 0.55rem;
    }

    .entity-page-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .subs-listado-summary {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ——— Ficha contacto + oportunidades IA ——— */
.entity-page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.entity-page-back {
    flex-shrink: 0;
}

.entity-page-title {
    flex: 1 1 auto;
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.entity-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: auto;
}

.card--entity {
    padding: 1.25rem 1.35rem;
}

.entity-form .form-textarea {
    min-height: 120px;
}

.entity-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.35rem;
}

.table-entity-link {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
}

.table-entity-link:hover {
    color: var(--accent-icon);
    text-decoration: underline;
}

.contact-ficha-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.contact-ficha-tab {
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-block;
}

.contact-ficha-tab:hover {
    color: var(--text-primary);
}

.contact-ficha-tab.is-active {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.contact-ficha-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.contact-ficha-list li {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.contact-ficha-list-meta {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.contact-ficha-list-sub {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.contact-ficha-highlight {
    font-weight: 600;
    margin: 0 0 0.75rem;
    color: var(--color-success);
}

.contact-ficha-more-link {
    margin: 0.65rem 0 0;
}

.contact-ficha-more-link a {
    color: var(--accent-focus);
    font-weight: 600;
    text-decoration: none;
}

.contact-ficha-more-link a:hover {
    text-decoration: underline;
}

.contact-ficha-pagination .is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.contact-ficha-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.contact-ficha-meta-count {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.contact-billing-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.contact-billing-year-select {
    min-width: 140px;
    font-size: 0.85rem;
}

.contact-billing-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--surface-elevated, #f8fafc);
    border-radius: 8px;
    border: 1px solid var(--border-color, #e5e7eb);
}

.contact-billing-total-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 0.2rem;
}

.contact-billing-total-item strong {
    font-size: 1rem;
}

.contact-invoice-src {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
}

.contact-invoice-num {
    font-family: ui-monospace, monospace;
    font-size: 0.8em;
}

.contact-ficha-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    justify-content: center;
    color: var(--text-secondary);
}

.contact-ficha-loading .ph-spinner {
    animation: contact-spin 0.9s linear infinite;
}

@keyframes contact-spin {
    to { transform: rotate(360deg); }
}

.contact-ai-panel__intro {
    margin-bottom: 1rem;
}

.contact-ai-sector {
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.contact-ai-meta-line {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.75rem 0 0;
}

.contact-ai-stale {
    color: #d97706;
    font-weight: 600;
}

.contact-ai-cards {
    display: grid;
    gap: 0.85rem;
}

.contact-ai-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    background: var(--bg-input);
}

.contact-ai-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.contact-ai-card__head h4 {
    margin: 0;
    font-size: 1rem;
}

.contact-ai-fit {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.contact-ai-fit--high {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.contact-ai-fit--mid {
    background: rgba(234, 179, 8, 0.18);
    color: #a16207;
}

.contact-ai-fit--low {
    background: rgba(148, 163, 184, 0.2);
    color: #475569;
}

.contact-ai-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.contact-ai-card__meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.contact-ai-next {
    margin: 1rem 0 0;
    font-weight: 600;
}

.contact-ai-avoid {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.contact-ai-avoid ul {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
}

.contact-ai-hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
}

.contact-notes-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.contact-notes-hint {
    margin: 0 0 0.75rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.contact-notes-textarea {
    width: 100%;
    min-height: 6rem;
    background: var(--bg-input);
    border-color: var(--border-color);
}

.contact-notes-meta {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.contact-notes-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.contact-notes-feedback {
    font-size: 0.85rem;
}

.contact-notes-feedback--ok {
    color: var(--success, #16a34a);
}

.contact-notes-feedback--error {
    color: var(--danger, #dc2626);
}

.contact-notes-form {
    margin-bottom: 1rem;
}

.contact-notes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-notes-item {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
}

.contact-notes-date {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.contact-notes-text {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.45;
}

.contact-ai-summary {
    margin-bottom: 0.35rem;
}

.contact-ai-summary-brief {
    margin: 0 0 0.35rem;
    line-height: 1.5;
}

.contact-ai-summary-detail {
    margin: 0 0 0.35rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.contact-ai-summary-detail.is-collapsed {
    display: none;
}

.contact-ai-read-more {
    appearance: none;
    border: none;
    background: none;
    padding: 0;
    color: var(--accent-icon);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-primary);
}

.contact-ai-read-more:hover {
    text-decoration: underline;
}

/* ==========================================================================
   ASISTENTE IA GLOBAL (CHAT FLOTANTE)
   ========================================================================== */
body.has-assistant-widget .floating-composer-trigger {
    right: 5.75rem;
}

.assistant-widget {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1100;
}

.assistant-fab {
    width: 3.5rem;
    height: 3.5rem;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 1.35rem;
    background: linear-gradient(135deg, var(--accent-strong) 0%, var(--brand-orange-deep) 100%);
    box-shadow: 0 10px 30px var(--accent-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.assistant-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px var(--accent-border);
}

.assistant-panel {
    position: absolute;
    right: 0;
    bottom: calc(3.5rem + 0.75rem);
    width: min(24rem, calc(100vw - 2rem));
    height: min(32rem, calc(100vh - 6rem));
    display: none;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-solid);
    backdrop-filter: var(--blur-effect);
    -webkit-backdrop-filter: var(--blur-effect);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.assistant-panel:not([hidden]) {
    display: flex;
}

.assistant-panel.is-open {
    animation: assistantPanelIn 0.22s ease;
}

@keyframes assistantPanelIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.assistant-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-overlay);
}

.assistant-panel__title {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.assistant-panel__subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.assistant-panel__actions {
    display: flex;
    gap: 0.35rem;
}

.assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.assistant-empty {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.45;
}

.assistant-msg {
    display: flex;
}

.assistant-msg--user {
    justify-content: flex-end;
}

.assistant-msg--assistant {
    justify-content: flex-start;
}

.assistant-msg__bubble {
    max-width: 92%;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    line-height: 1.45;
    font-size: 0.92rem;
    white-space: pre-wrap;
}

.assistant-msg--user .assistant-msg__bubble {
    background: var(--accent-bg-strong);
    border: 1px solid var(--accent-border);
}

.assistant-msg--assistant .assistant-msg__bubble {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
}

.assistant-form {
    border-top: 1px solid var(--border-color);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.assistant-input {
    min-height: 4.5rem;
    resize: vertical;
    background: var(--bg-input);
}

.assistant-form__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.assistant-status {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    body.has-assistant-widget .floating-composer-trigger {
        right: 1.25rem;
        bottom: 5.5rem;
    }

    .assistant-panel {
        width: calc(100vw - 1.5rem);
        right: -0.25rem;
    }
}

/* ——— Proyectos: fechas editables + Gantt ——— */
.projects-list-hint {
    margin: -0.35rem 0 0.85rem;
}

.project-inline-date {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    border: 1px dashed hsla(220, 20%, 40%, 0.55);
    border-radius: 6px;
    background: var(--bg-btn-secondary);
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.project-inline-date:hover,
.project-inline-date:focus-visible {
    border-color: rgba(107, 102, 94, 0.35);
    background: rgba(107, 102, 94, 0.08);
    outline: none;
}

.project-inline-date.is-empty {
    color: var(--text-muted);
}

.project-inline-date.is-saving {
    opacity: 0.55;
    pointer-events: none;
}

.card--gantt {
    padding: 1rem 1.1rem 1.25rem;
}

.gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 0.85rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.gantt-legend-dot {
    display: inline-block;
    width: 0.85rem;
    height: 0.55rem;
    border-radius: 3px;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.gantt-legend-dot--fixed {
    background: linear-gradient(135deg, var(--accent-strong) 0%, var(--brand-orange-deep) 100%);
}

.gantt-legend-dot--open {
    background: linear-gradient(90deg, hsl(38, 92%, 50%) 0%, hsla(38, 92%, 50%, 0.15) 100%);
    border-right: 2px dashed hsl(38, 92%, 50%);
}

.gantt-scroll {
    overflow-x: auto;
}

.gantt-chart {
    min-width: 720px;
}

.gantt-header,
.gantt-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(480px, 1fr);
    gap: 0;
    align-items: stretch;
}

.gantt-header {
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface-solid);
}

.gantt-header-label,
.gantt-row-label {
    padding: 0.65rem 0.75rem;
    border-right: 1px solid var(--border-color);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gantt-header-track,
.gantt-row-track {
    position: relative;
    min-height: 2.6rem;
    border-bottom: 1px solid hsla(220, 20%, 25%, 0.25);
}

.gantt-ticks {
    position: relative;
    height: 2.2rem;
}

.gantt-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px solid hsla(220, 20%, 25%, 0.35);
    padding: 0.45rem 0.35rem 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-row-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.gantt-row-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}

.gantt-row-title:hover {
    color: var(--accent-secondary);
}

.gantt-row-client {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.gantt-row-track {
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent calc(8.333% - 1px),
            hsla(220, 20%, 25%, 0.12) calc(8.333% - 1px),
            hsla(220, 20%, 25%, 0.12) 8.333%
        );
}

.gantt-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 1.35rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-strong) 0%, var(--brand-orange-deep) 100%);
    box-shadow: 0 2px 8px rgba(255, 135, 0, 0.25);
    min-width: 0.35rem;
    overflow: hidden;
}

.gantt-bar--open-end {
    background: linear-gradient(90deg, hsl(38, 92%, 50%) 0%, hsla(38, 92%, 50%, 0.35) 55%, hsla(38, 92%, 50%, 0.08) 100%);
    border-right: 2px dashed hsl(38, 92%, 58%);
    border-radius: 999px 0 0 999px;
    box-shadow: 0 2px 8px hsla(38, 92%, 50%, 0.18);
}

.gantt-bar--no-start {
    left: 0;
    width: 2rem;
    opacity: 0.45;
    background: hsla(215, 12%, 48%, 0.35);
}

.gantt-bar-label {
    display: block;
    padding: 0 0.45rem;
    font-size: 0.68rem;
    line-height: 1.35rem;
    color: hsl(210, 40%, 98%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-bar--open-end .gantt-bar-label {
    color: hsl(38, 95%, 92%);
}

.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: hsl(350, 84%, 55%);
    z-index: 1;
    pointer-events: none;
}

.gantt-today-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: hsl(350, 84%, 55%);
}

.flatpickr-clear-btn {
    display: block;
    width: calc(100% - 1rem);
    margin: 0.35rem auto 0.5rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid hsla(220, 20%, 35%, 0.6);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
}

.flatpickr-clear-btn:hover {
    color: var(--text-primary);
    border-color: rgba(107, 102, 94, 0.28);
}

@media (max-width: 768px) {
    .gantt-header,
    .gantt-row {
        grid-template-columns: minmax(140px, 180px) minmax(360px, 1fr);
    }
}

/* Toggle tema claro / oscuro */
.theme-toggle {
    min-width: 2.75rem;
    justify-content: center;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.theme-toggle .ph {
    font-size: 1.15rem;
}

html[data-theme="dark"] .theme-icon-light,
html:not([data-theme]) .theme-icon-light {
    display: inline-flex;
}

html[data-theme="dark"] .theme-icon-dark,
html:not([data-theme]) .theme-icon-dark {
    display: none;
}

html[data-theme="light"] .theme-icon-light {
    display: none;
}

html[data-theme="light"] .theme-icon-dark {
    display: inline-flex;
}

.login-theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 50;
}

html[data-theme="light"] .metric-card.style-purple .metric-icon,
html[data-theme="light"] .metric-icon {
    color: var(--accent-strong);
}

html[data-theme="light"] .sidebar-nav-link.is-active {
    color: var(--brand-charcoal);
}

html[data-theme="light"] .section-subnav-link.is-active {
    color: var(--brand-charcoal);
}

html[data-theme="light"] .dashboard-tab.is-active .ph {
    color: var(--accent-strong);
}

html[data-theme="light"] .assistant-fab {
    box-shadow: 0 12px 28px rgba(255, 135, 0, 0.28);
}
