/* =================================================================
 * FeedPro · Modern SaaS Theme
 * Refactored: Inter, neutral palette, subtle shadows, clean tables.
 * Compatible with the existing template class names.
 * ================================================================= */

@import url('https://rsms.me/inter/inter.css');

/* -------------------- 1. Design tokens -------------------- */
:root {
    /* Brand */
    --brand: #15803d;            /* emerald-700 */
    --brand-600: #16a34a;        /* emerald-600 */
    --brand-500: #22c55e;
    --brand-100: #dcfce7;
    --brand-50:  #f0fdf4;

    /* Neutrals (slate) */
    --bg:        #f6f8fa;        /* page bg */
    --surface:   #ffffff;        /* cards / sidebar */
    --surface-2: #f9fafb;        /* striped rows, hover */
    --border:    #e5e7eb;        /* subtle border */
    --border-strong: #d1d5db;
    --text:      #0f172a;        /* slate-900 */
    --text-2:    #475569;        /* slate-600 */
    --text-3:    #64748b;        /* slate-500 */
    --muted:     #94a3b8;        /* slate-400 */

    /* Status */
    --success:   #16a34a;
    --warning:   #d97706;
    --danger:    #dc2626;
    --info:      #0284c7;

    /* Radius */
    --r-sm: 6px;
    --r:    8px;
    --r-lg: 12px;
    --r-xl: 16px;

    /* Shadow (subtle, single accent) */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow:    0 4px 6px -2px rgba(15, 23, 42, .05), 0 8px 16px -4px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 24px -8px rgba(15, 23, 42, .12), 0 4px 8px -2px rgba(15, 23, 42, .06);

    /* Misc */
    --ring: 0 0 0 3px rgba(34, 197, 94, .18);
    --transition: 160ms cubic-bezier(.4, 0, .2, 1);

    /* Legacy aliases (kept so old templates keep working) */
    --primary-color: var(--brand);
    --primary-dark:  #166534;
    --secondary-color: #1f2937;
    --secondary-dark:  #111827;
    --accent-color:    var(--info);
    --danger-color:    var(--danger);
    --warning-color:   var(--warning);
    --success-color:   var(--success);
    --light-bg:    var(--bg);
    --white:       var(--surface);
    --border-color:var(--border);
    --text-dark:   var(--text);
    --text-muted:  var(--text-3);
    --border-radius:    var(--r);
    --border-radius-sm: var(--r-sm);
}

/* -------------------- 2. Base / Reset -------------------- */
html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg);
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-feature-settings: 'cv11', 'ss01';
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@supports (font-variation-settings: normal) {
    body { font-family: 'InterVariable', 'Inter', system-ui, sans-serif; }
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    margin-bottom: .5rem;
}

h1 { font-size: 1.625rem; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: .9375rem; }
h6 { font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }

a { color: var(--brand-600); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand); text-decoration: none; }

hr { border: 0; border-top: 1px solid var(--border); opacity: 1; margin: 1.25rem 0; }

::selection { background: var(--brand-100); color: var(--brand); }

/* Scrollbar (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* -------------------- 3. Layout helpers -------------------- */
main {
    background-color: var(--bg) !important;
    min-height: 100vh;
    padding: 1.5rem 2rem !important;
    overflow-x: hidden;
    box-sizing: border-box;
}

main > * { max-width: 100%; }

/* Tablas anchas: scroll dentro del card en lugar de desbordar la página */
main .table-responsive,
main .card,
main .info-section { overflow-x: auto; }

main .table { min-width: 0; }

.container,
.container-fluid { padding-left: 0; padding-right: 0; max-width: 100%; }

/* -------------------- 4. Sidebar (overrides inline styles in layout.html) -------------------- */
.sidebar {
    background: var(--surface) !important;
    border-right: 1px solid var(--border);
    box-shadow: none !important;
    width: 240px !important;
    padding: 1rem .75rem !important;
}

.sidebar .sidebar-header {
    padding: .25rem .25rem 1rem .25rem !important;
    border-bottom: 1px solid var(--border) !important;
    margin-bottom: 1rem !important;
    text-align: left !important;
}

.sidebar .feedpro-logo {
    height: 34px !important;
    width: auto !important;
    margin: 0 !important;
}

.sidebar .user-info {
    background: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
    padding: .75rem !important;
    margin-bottom: 1.25rem !important;
    text-align: left !important;
    display: flex;
    align-items: center;
    gap: .625rem;
}

.sidebar .user-avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--brand-600), var(--brand)) !important;
    box-shadow: none !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
}

.sidebar .user-avatar i { font-size: 14px !important; color: #fff !important; }

.sidebar .user-info h6 {
    margin: 0 0 2px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    line-height: 1.2;
}

.sidebar .user-info small {
    color: var(--text-3) !important;
    font-size: 11px !important;
    line-height: 1.3;
}

.sidebar .nav-section { margin-bottom: 1rem !important; }

.sidebar .nav-section-title {
    color: var(--muted) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 0 .5rem !important;
    margin-bottom: .375rem !important;
}

.sidebar .nav-link {
    color: var(--text-2) !important;
    padding: .5rem .625rem !important;
    margin: 1px 0 !important;
    border-radius: var(--r-sm) !important;
    font-weight: 500 !important;
    font-size: 13.5px !important;
    display: flex !important;
    align-items: center !important;
    gap: .625rem;
    transition: background-color var(--transition), color var(--transition);
}

.sidebar .nav-link i {
    width: 16px !important;
    text-align: center;
    font-size: 13px !important;
    color: var(--text-3);
    margin: 0 !important;
}

.sidebar .nav-link:hover {
    background-color: var(--surface-2) !important;
    color: var(--text) !important;
    transform: none !important;
}

.sidebar .nav-link:hover i { color: var(--brand); }

.sidebar .nav-link.active {
    background-color: var(--brand-50) !important;
    color: var(--brand) !important;
}

.sidebar .nav-link.active i { color: var(--brand) !important; }

.sidebar .nav-link.text-danger { color: var(--danger) !important; }
.sidebar .nav-link.text-danger:hover { background: #fef2f2 !important; }
.sidebar .nav-link.text-danger i { color: var(--danger) !important; }

/* -------------------- 5. Page header (.feedpro-header) -------------------- */
.feedpro-header {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
    border-radius: var(--r-lg) !important;
    padding: 1.25rem 1.5rem !important;
    margin-bottom: 1.5rem !important;
    box-shadow: var(--shadow-xs) !important;
    text-align: left !important;
}

.feedpro-header h1,
.feedpro-header h2,
.feedpro-header h3,
.feedpro-header .panel-title {
    color: var(--text) !important;
    font-weight: 600 !important;
    font-size: 1.375rem !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    gap: .625rem;
}

.feedpro-header .panel-title i {
    color: var(--brand) !important;
    background: var(--brand-50);
    padding: 8px;
    border-radius: var(--r-sm);
    font-size: 1rem !important;
    margin: 0 !important;
}

.feedpro-header .panel-subtitle,
.feedpro-header small,
.feedpro-header p {
    color: var(--text-3) !important;
    font-size: .8125rem !important;
    margin: .25rem 0 0 !important;
    opacity: 1 !important;
}

/* -------------------- 6. Cards -------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}

.card-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: .875rem 1.25rem;
    font-weight: 600;
}

.card-body { padding: 1.25rem; }
.card-footer { background: var(--surface); border-top: 1px solid var(--border); }

.info-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition);
}

.info-section:hover {
    box-shadow: var(--shadow-sm);
    transform: none !important;
}

.section-title {
    color: var(--text) !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    margin-bottom: 1rem !important;
    padding-bottom: .625rem !important;
    border-bottom: 1px solid var(--border) !important;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.section-title i {
    color: var(--brand) !important;
    margin: 0 !important;
}

/* -------------------- 7. Summary cards (dashboard) -------------------- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: var(--surface) !important;
    color: var(--text) !important;
    padding: 1.25rem !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-lg) !important;
    text-align: left !important;
    box-shadow: var(--shadow-xs) !important;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.summary-card::before { display: none !important; }

.summary-card:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--border-strong) !important;
}

.summary-card-content {
    display: flex !important;
    align-items: flex-start !important;
    gap: 1rem;
}

.summary-icon {
    width: 40px; height: 40px;
    border-radius: var(--r);
    background: var(--brand-50);
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.summary-info { flex: 1; min-width: 0; }

.summary-card h3,
.summary-card h4,
.summary-card h5,
.summary-info h4 {
    color: var(--text) !important;
    font-size: 1.75rem !important;
    font-weight: 600 !important;
    margin: 0 0 .125rem !important;
    line-height: 1.1;
    letter-spacing: -0.02em;
    display: block !important;
}

.summary-card small,
.summary-info small {
    color: var(--text-3) !important;
    font-size: .8125rem !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    display: block;
}

.summary-trend {
    display: flex !important;
    align-items: center;
    gap: .375rem;
    font-size: .75rem !important;
    margin-top: .375rem;
}

.summary-trend i { font-size: 10px; }

/* -------------------- 8. Nav cards (dashboard quick access) -------------------- */
.nav-card,
.nav-card-modern {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    color: var(--text);
    text-decoration: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    position: relative;
}

.nav-card:hover,
.nav-card-modern:hover {
    border-color: var(--brand-500);
    box-shadow: var(--shadow-xs);
    color: var(--text);
}

.nav-card-icon-modern,
.nav-card-icon {
    width: 40px; height: 40px;
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    color: #fff;
    background: var(--brand);
    flex-shrink: 0;
}

.nav-card-icon-modern.bg-primary { background: var(--brand) !important; }
.nav-card-icon-modern.bg-success { background: var(--success) !important; }
.nav-card-icon-modern.bg-info    { background: var(--info)    !important; }
.nav-card-icon-modern.bg-warning { background: var(--warning) !important; }
.nav-card-icon-modern.bg-danger  { background: var(--danger)  !important; }

.nav-card-content { flex: 1; min-width: 0; }

.nav-card-content h6,
.nav-card h5 {
    color: var(--text) !important;
    font-size: .9375rem !important;
    font-weight: 600 !important;
    margin: 0 0 .125rem !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.nav-card-content p,
.nav-card p {
    color: var(--text-3) !important;
    font-size: .8125rem !important;
    margin: 0 !important;
    line-height: 1.4;
}

.nav-card-arrow {
    color: var(--muted);
    font-size: 14px;
}
.nav-card-modern:hover .nav-card-arrow { color: var(--brand); }

/* -------------------- 9. Buttons -------------------- */
.btn {
    border-radius: var(--r-sm);
    font-weight: 500;
    font-size: .875rem;
    padding: .5rem .875rem;
    border: 1px solid transparent;
    transition: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
    box-shadow: none !important;
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    line-height: 1.4;
}

.btn:hover { transform: none !important; }
.btn:focus-visible { box-shadow: var(--ring) !important; outline: none; }

.btn-sm { padding: .375rem .625rem; font-size: .8125rem; }
.btn-lg { padding: .625rem 1.125rem; font-size: .9375rem; }

.btn-primary {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #fff !important;
}
.btn-primary:hover {
    background: #166534 !important;
    border-color: #166534 !important;
    color: #fff !important;
}

.btn-secondary {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}
.btn-secondary:hover {
    background: var(--surface-2) !important;
    border-color: var(--border-strong) !important;
    color: var(--text) !important;
}

.btn-success {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: #fff !important;
}
.btn-success:hover { background: #15803d !important; border-color: #15803d !important; }

.btn-danger {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #fff !important;
}
.btn-danger:hover { background: #b91c1c !important; border-color: #b91c1c !important; }

.btn-warning {
    background: var(--warning) !important;
    border-color: var(--warning) !important;
    color: #fff !important;
}
.btn-warning:hover { background: #b45309 !important; border-color: #b45309 !important; color: #fff !important; }

.btn-info {
    background: var(--info) !important;
    border-color: var(--info) !important;
    color: #fff !important;
}
.btn-info:hover { background: #0369a1 !important; border-color: #0369a1 !important; }

.btn-outline-primary {
    background: transparent !important;
    border-color: var(--brand) !important;
    color: var(--brand) !important;
}
.btn-outline-primary:hover { background: var(--brand-50) !important; color: var(--brand) !important; }

.btn-outline-secondary {
    background: transparent !important;
    border-color: var(--border) !important;
    color: var(--text-2) !important;
}
.btn-outline-secondary:hover { background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--border-strong) !important; }

.btn-outline-danger {
    background: transparent !important;
    border-color: var(--danger) !important;
    color: var(--danger) !important;
}
.btn-outline-danger:hover { background: #fef2f2 !important; color: var(--danger) !important; }

.btn-link { color: var(--brand-600) !important; text-decoration: none; }
.btn-link:hover { color: var(--brand) !important; text-decoration: underline; }

/* -------------------- 10. Forms -------------------- */
.form-label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: .375rem;
}

.form-control,
.form-select {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: .875rem;
    padding: .5rem .75rem;
    min-height: 38px;
    transition: border-color var(--transition), box-shadow var(--transition);
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-500);
    box-shadow: var(--ring);
    outline: none;
}

.form-control::placeholder { color: var(--muted); }

.form-text { color: var(--text-3); font-size: .75rem; }

.input-group-text {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-3);
    font-size: .8125rem;
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}
.form-check-input:focus { border-color: var(--brand-500); box-shadow: var(--ring); }

/* -------------------- 11. Tables -------------------- */
.table {
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: none;
    margin-bottom: 0;
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--surface-2);
    --bs-table-striped-bg: var(--surface-2);
    font-size: .875rem;
}

.table th {
    background: var(--surface-2) !important;
    color: var(--text-2) !important;
    border-bottom: 1px solid var(--border) !important;
    border-top: none !important;
    font-weight: 600 !important;
    text-transform: none !important;
    font-size: .75rem !important;
    letter-spacing: .03em;
    padding: .625rem .875rem !important;
    text-align: left;
    white-space: nowrap;
}

.table-light th,
.table-light td {
    background: var(--surface-2) !important;
    color: var(--text-2) !important;
    border-color: var(--border) !important;
}

.table td {
    vertical-align: middle;
    padding: .625rem .875rem !important;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text);
}

.table tbody tr:hover {
    background-color: var(--surface-2) !important;
}

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

/* Numerical columns: tabular figures */
.table td.num,
.table .text-end {
    font-variant-numeric: tabular-nums;
}

/* -------------------- 12. Badges -------------------- */
.badge {
    font-weight: 500;
    font-size: .6875rem;
    padding: .25rem .5rem;
    border-radius: 99px;
    letter-spacing: .02em;
}

.badge.bg-primary { background: var(--brand-50) !important; color: var(--brand) !important; }
.badge.bg-success { background: #dcfce7 !important; color: #166534 !important; }
.badge.bg-warning { background: #fef3c7 !important; color: #92400e !important; }
.badge.bg-danger  { background: #fee2e2 !important; color: #991b1b !important; }
.badge.bg-info    { background: #e0f2fe !important; color: #075985 !important; }
.badge.bg-secondary { background: var(--surface-2) !important; color: var(--text-2) !important; }

/* -------------------- 13. Alerts -------------------- */
.alert {
    border-radius: var(--r);
    border: 1px solid transparent;
    padding: .75rem 1rem;
    font-size: .875rem;
}

.alert-primary { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: #f0f9ff; color: #075985; border-color: #bae6fd; }

/* -------------------- 14. Modals -------------------- */
.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header { border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; }
.modal-footer { border-top: 1px solid var(--border); padding: .875rem 1.25rem; }
.modal-body   { padding: 1.25rem; }

/* -------------------- 15. Dropdowns -------------------- */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    padding: .375rem;
    font-size: .875rem;
}

.dropdown-item {
    border-radius: var(--r-sm);
    padding: .5rem .625rem;
    color: var(--text-2);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--surface-2);
    color: var(--text);
}

.dropdown-divider { border-top: 1px solid var(--border); margin: .375rem 0; }

/* -------------------- 16. Animations -------------------- */
@keyframes feedproFadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: feedproFadeInUp .4s cubic-bezier(.4,0,.2,1) both; }

/* -------------------- 17. Misc utilities & legacy classes -------------------- */
.tool-card,
.stat-card,
.selector-card,
.categoria-card,
.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    padding: 1.25rem;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: .125rem .5rem;
    font-size: .6875rem;
    color: var(--text-2);
}

.status-active {
    background: #dcfce7;
    color: #166534;
    padding: .125rem .5rem;
    border-radius: 99px;
    font-size: .6875rem;
    font-weight: 500;
}

.text-muted { color: var(--text-3) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info) !important; }
.text-primary { color: var(--brand) !important; }

.bg-white { background: var(--surface) !important; }
.bg-light { background: var(--surface-2) !important; }
.shadow-sm { box-shadow: var(--shadow-xs) !important; }
.shadow    { box-shadow: var(--shadow-sm) !important; }
.shadow-lg { box-shadow: var(--shadow) !important; }

/* Numeric callouts */
.metric-number {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* Code/mono for technical data */
code, pre, kbd, samp, .mono {
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
    font-size: .8125rem;
}

/* -------------------- 18. Responsive -------------------- */
@media (max-width: 992px) {
    main { padding: 1rem !important; }
}

@media (max-width: 768px) {
    .summary-cards { grid-template-columns: 1fr; }
    .feedpro-header { padding: 1rem !important; }
    .feedpro-header .panel-title { font-size: 1.125rem !important; }
}

/* =================================================================
 * 19. DARK MODE
 * ================================================================= */
body.tema-oscuro {
    --bg:        #0b1120;
    --surface:   #111827;
    --surface-2: #1f2937;
    --border:    #1f2937;
    --border-strong: #374151;
    --text:      #f1f5f9;
    --text-2:    #cbd5e1;
    --text-3:    #94a3b8;
    --muted:     #64748b;

    --brand-50:  rgba(34, 197, 94, .1);
    --brand-100: rgba(34, 197, 94, .18);

    --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.35);
    --shadow:    0 6px 18px rgba(0,0,0,.45);
    --shadow-lg: 0 16px 32px rgba(0,0,0,.5);
}

body.tema-oscuro main { background: var(--bg) !important; }

body.tema-oscuro .sidebar {
    background: var(--surface) !important;
    border-right-color: var(--border) !important;
}

body.tema-oscuro .sidebar .nav-link { color: var(--text-2) !important; }
body.tema-oscuro .sidebar .nav-link:hover { background: var(--surface-2) !important; color: var(--text) !important; }
body.tema-oscuro .sidebar .nav-link.active { background: var(--brand-100) !important; color: var(--brand-500) !important; }
body.tema-oscuro .sidebar .nav-link.active i { color: var(--brand-500) !important; }
body.tema-oscuro .sidebar .nav-link.text-danger:hover { background: rgba(239,68,68,.1) !important; }

body.tema-oscuro .feedpro-header,
body.tema-oscuro .card,
body.tema-oscuro .info-section,
body.tema-oscuro .summary-card,
body.tema-oscuro .nav-card,
body.tema-oscuro .nav-card-modern,
body.tema-oscuro .tool-card,
body.tema-oscuro .stat-card,
body.tema-oscuro .selector-card,
body.tema-oscuro .categoria-card,
body.tema-oscuro .detail-card,
body.tema-oscuro .modal-content {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

body.tema-oscuro .feedpro-header .panel-title,
body.tema-oscuro .feedpro-header h1,
body.tema-oscuro .feedpro-header h2,
body.tema-oscuro .feedpro-header h3,
body.tema-oscuro .summary-info h4,
body.tema-oscuro .nav-card-content h6,
body.tema-oscuro .summary-card h3,
body.tema-oscuro .summary-card h4 {
    color: var(--text) !important;
}

body.tema-oscuro .feedpro-header .panel-title i {
    background: var(--brand-100) !important;
    color: var(--brand-500) !important;
}

body.tema-oscuro .summary-icon {
    background: var(--brand-100) !important;
    color: var(--brand-500) !important;
}

body.tema-oscuro .summary-info small,
body.tema-oscuro .summary-trend span,
body.tema-oscuro .nav-card-content p,
body.tema-oscuro .form-text,
body.tema-oscuro .text-muted {
    color: var(--text-3) !important;
}

body.tema-oscuro .form-control,
body.tema-oscuro .form-select {
    background: var(--bg);
    border-color: var(--border-strong);
    color: var(--text);
}

body.tema-oscuro .form-control::placeholder { color: var(--muted); }

body.tema-oscuro .form-control:focus,
body.tema-oscuro .form-select:focus {
    background: var(--bg);
    border-color: var(--brand-500);
    box-shadow: var(--ring);
}

body.tema-oscuro .input-group-text {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-3);
}

body.tema-oscuro .table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--surface-2);
    --bs-table-striped-bg: var(--surface-2);
}

body.tema-oscuro .table th {
    background: var(--surface-2) !important;
    color: var(--text-2) !important;
    border-bottom-color: var(--border) !important;
}

body.tema-oscuro .table td {
    color: var(--text) !important;
    border-bottom-color: var(--border) !important;
    background: var(--surface) !important;
}

body.tema-oscuro .table tbody tr:hover td {
    background: var(--surface-2) !important;
}

body.tema-oscuro .table > :not(caption) > * > * {
    background-color: transparent !important;
    color: var(--text) !important;
}

body.tema-oscuro .bg-white,
body.tema-oscuro .input-group-text.bg-white,
body.tema-oscuro .card-header.bg-white {
    background-color: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.tema-oscuro .table-light,
body.tema-oscuro .table-light > :not(caption) > * > * {
    background-color: var(--surface-2) !important;
    color: var(--text-2) !important;
    border-color: var(--border) !important;
}

body.tema-oscuro hr { border-color: var(--border) !important; }

body.tema-oscuro .dropdown-menu {
    background: var(--surface);
    border-color: var(--border-strong);
}

body.tema-oscuro .dropdown-item { color: var(--text-2); }
body.tema-oscuro .dropdown-item:hover { background: var(--surface-2); color: var(--text); }

body.tema-oscuro .feature-tag { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-2); }

body.tema-oscuro .btn-secondary {
    background: var(--surface-2) !important;
    border-color: var(--border-strong) !important;
    color: var(--text) !important;
}
body.tema-oscuro .btn-secondary:hover {
    background: #2a3445 !important;
    color: var(--text) !important;
}

body.tema-oscuro .btn-outline-secondary {
    border-color: var(--border-strong) !important;
    color: var(--text-2) !important;
}
body.tema-oscuro .btn-outline-secondary:hover {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}

body.tema-oscuro ::-webkit-scrollbar-thumb { background: #334155; border-color: var(--bg); }
body.tema-oscuro ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* =================================================================
 * 20. FORMULADOR — column widths
 * Make INGREDIENTE / NUTRIENTE columns wider, numeric inputs compact.
 * ================================================================= */

/* Ingredient table: [name | inclusion | min | max | peso | costo | valor | acciones] */
.formulador-table { table-layout: fixed; width: 100%; }

.formulador-table th,
.formulador-table td { padding: .5rem .5rem !important; vertical-align: middle; }

.formulador-table th:nth-child(1),
.formulador-table td:nth-child(1) { width: auto; min-width: 150px; }

.formulador-table th:nth-child(2),
.formulador-table td:nth-child(2),
.formulador-table th:nth-child(3),
.formulador-table td:nth-child(3),
.formulador-table th:nth-child(4),
.formulador-table td:nth-child(4) { width: 90px; }

.formulador-table th:nth-child(5),
.formulador-table td:nth-child(5),
.formulador-table th:nth-child(6),
.formulador-table td:nth-child(6),
.formulador-table th:nth-child(7),
.formulador-table td:nth-child(7) { width: 100px; }

.formulador-table th:nth-child(8),
.formulador-table td:nth-child(8) { width: 110px; text-align: center; }

/* Nutrients table: [nutriente | unidad | sugerido | min | max | tc | bs | acciones] */
.nutrientes-table { table-layout: fixed; width: 100%; }

.nutrientes-table th,
.nutrientes-table td { padding: .5rem .5rem !important; vertical-align: middle; }

.nutrientes-table th:nth-child(1),
.nutrientes-table td:nth-child(1) { width: auto; min-width: 150px; }

.nutrientes-table th:nth-child(2),
.nutrientes-table td:nth-child(2) { width: 80px; }

.nutrientes-table th:nth-child(3),
.nutrientes-table td:nth-child(3),
.nutrientes-table th:nth-child(4),
.nutrientes-table td:nth-child(4),
.nutrientes-table th:nth-child(5),
.nutrientes-table td:nth-child(5) { width: 90px; }

.nutrientes-table th:nth-child(6),
.nutrientes-table td:nth-child(6),
.nutrientes-table th:nth-child(7),
.nutrientes-table td:nth-child(7) { width: 110px; text-align: right; }

.nutrientes-table th:nth-child(8),
.nutrientes-table td:nth-child(8) { width: 90px; text-align: center; }

/* Inputs inside both formulador tables: keep them compact */
.formulador-table input.form-control,
.nutrientes-table input.form-control,
.formulador-table .form-select-sm,
.nutrientes-table .form-select-sm {
    width: 100%;
    min-width: 0;
    padding: .25rem .4rem;
    font-size: .8125rem;
    min-height: 32px;
}

/* Selects of name (full width inside cell, ellipsis if too long) */
.formulador-table .select-ingrediente,
.nutrientes-table .select-nutriente {
    width: 100%;
    text-overflow: ellipsis;
}

/* Action buttons row: clearer, with subtle tinted background per kind */
.btn-action-container {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}
.btn-action {
    width: 30px; height: 30px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    transition: background-color .15s, color .15s, border-color .15s;
    padding: 0;
    line-height: 1;
}
.btn-action:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-action:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-action.btn-action-drag {
    cursor: grab;
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-3);
}
.btn-action.btn-action-drag i {
    font-size: 14px;
    opacity: .85;
}
.btn-action.btn-action-drag:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-action.btn-action-drag:hover i { opacity: 1; }
.btn-action.btn-action-drag:active { cursor: grabbing; }

.btn-action.btn-action-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger);
}
.btn-action.btn-action-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-action.btn-action-info {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: var(--info);
}
.btn-action.btn-action-info:hover {
    background: var(--info);
    border-color: var(--info);
    color: #fff;
}

/* Dark mode tweaks */
body.tema-oscuro .btn-action {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-2);
}
body.tema-oscuro .btn-action:hover { background: #2a3445; color: var(--text); border-color: #4b5563; }

body.tema-oscuro .btn-action.btn-action-danger {
    background: rgba(239, 68, 68, .14);
    border-color: rgba(239, 68, 68, .32);
    color: #fca5a5;
}
body.tema-oscuro .btn-action.btn-action-danger:hover {
    background: var(--danger); border-color: var(--danger); color: #fff;
}

body.tema-oscuro .btn-action.btn-action-info {
    background: rgba(2, 132, 199, .18);
    border-color: rgba(2, 132, 199, .35);
    color: #7dd3fc;
}
body.tema-oscuro .btn-action.btn-action-info:hover {
    background: var(--info); border-color: var(--info); color: #fff;
}

body.tema-oscuro .btn-action.btn-action-drag { color: var(--text-3); }
body.tema-oscuro .btn-action.btn-action-drag:hover { background: #2a3445; color: var(--text-2); }

/* Allow horizontal scroll only inside formulador tables on small screens */
@media (max-width: 1280px) {
    .formulador-table,
    .nutrientes-table { table-layout: auto; }
}

/* =================================================================
 * 21. Optimization summary — floating button to reopen last report
 * ================================================================= */
.last-summary-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    border-radius: 99px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 980;
    display: none;
    align-items: center;
    gap: 8px;
    transition: background-color .15s, transform .15s, box-shadow .15s;
    animation: lastSummarySlideIn .25s cubic-bezier(.4,0,.2,1);
}
.last-summary-btn:hover {
    background: #166534;
    border-color: #166534;
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -8px rgba(15, 23, 42, .25);
}
.last-summary-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.last-summary-btn.show { display: inline-flex; }

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

body.tema-oscuro .last-summary-btn {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
body.tema-oscuro .last-summary-btn:hover { background: #166534; border-color: #166534; }

/* End of file */
