/* ==========================================================================
   1. VARIABLES & TOKENS
   ========================================================================== */
:root {
    /* 
     * Brand Colors (Ensenyem)
     * Primary: #820303 (Ensenyem Red)
     */
    --primary-50:  #fdf2f2;
    --primary-100: #fde8e8;
    --primary-200: #fbd5d5;
    --primary-300: #f8b4b4;
    --primary-400: #f98080;
    --primary-500: #820303; /* Brand Base */
    --primary-600: #6b0202; /* Brand Dark/Hover */
    --primary-700: #540101;
    --primary-800: #450a0a;
    --primary-900: #360808;

    /* Neutrals (Slate) */
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic Colors */
    --success-bg: #ecfdf5;
    --success-text: #059669;
    --success-border: #a7f3d0;

    --danger-bg: #fef2f2;
    --danger-text: #dc2626;
    --danger-border: #fecaca;

    --warning-bg: #fffbeb;
    --warning-text: #d97706;
    --warning-border: #fde68a;

    --info-bg: #eff6ff;
    --info-text: #2563eb;
    --info-border: #bfdbfe;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 0.75rem;   /* 12px */
    --font-size-sm: 0.875rem;  /* 14px */
    --font-size-base: 1rem;    /* 16px */
    --font-size-lg: 1.125rem;  /* 18px */
    --font-size-xl: 1.25rem;   /* 20px */
    --font-size-2xl: 1.5rem;   /* 24px */

    /* Spacing & Layout */
    --header-height: 64px;
    --sidebar-width: 260px;
    --container-padding: 2.5rem; /* Increased from 2rem */
    --border-radius-sm: 0.375rem;
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    --transition-base: all 0.2s ease-in-out;
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6; /* Increased from 1.5 */
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    color: var(--gray-900);
}

h1 { font-size: var(--font-size-2xl); letter-spacing: -0.025em; }
h2 { font-size: var(--font-size-xl); letter-spacing: -0.025em; }
h3 { font-size: var(--font-size-lg); }

p { margin: 0 0 1rem; }
a { color: var(--primary-600); text-decoration: none; transition: var(--transition-base); }
a:hover { color: var(--primary-700); }

/* ==========================================================================
   3. LAYOUT STRUCTURE
   ========================================================================== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Dark Theme for Professional Contrast) */
.sidebar {
    width: var(--sidebar-width);
    background-color: white;
    color: var(--gray-700);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    border-right: 1px solid var(--gray-200);
}

.sidebar__header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar__logo {
    max-height: 40px;
    width: auto;
    display: block;
}

.sidebar__nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: sticky;
    top: 0;
}

.sidebar__nav a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--gray-600);
    border-radius: var(--border-radius);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.sidebar__nav a:hover, 
.sidebar__nav a.is-active {
    background-color: var(--primary-50);
    color: var(--primary-700);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent flex overflow */
}

/* Topbar */
.topbar {
    height: var(--header-height);
    background-color: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--container-padding);
    z-index: 40;
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.topbar__env {
    background-color: var(--gray-100);
    color: var(--gray-600);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: var(--font-size-sm);
    color: var(--gray-600);
}

/* Page Content */
.content-area {
    padding: var(--container-padding);
    flex: 1;
    min-width: 0; /* allow cards/tables to shrink inside flex layout */
}

/* ==========================================================================
   4. COMPONENTS
   ========================================================================== */

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    padding: 2rem; /* Increased from 1.5rem */
    margin-bottom: 2rem; /* Increased from 1.5rem */
}

.card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.card__header h1 {
    font-size: var(--font-size-xl);
    margin-bottom: 0.25rem;
}

.card__header p {
    color: var(--gray-500);
    font-size: var(--font-size-sm);
    margin: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-base);
    gap: 0.5rem;
    line-height: 1.25;
}

.btn__icon {
    display: inline-flex;
    align-items: center;
}

.btn:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.btn--primary {
    background-color: var(--primary-500);
    color: white;
}
.btn--primary:hover { background-color: var(--primary-600); }

.btn--secondary {
    background-color: white;
    border-color: var(--gray-300);
    color: var(--gray-700);
}
.btn--secondary:hover { background-color: var(--gray-50); border-color: var(--gray-400); }

.btn--success {
    background-color: var(--success-text);
    color: white;
}
.btn--success:hover { background-color: #047857; }

.btn--danger {
    background-color: var(--danger-text);
    color: white;
}
.btn--danger:hover { background-color: #b91c1c; }

.btn--ghost {
    background-color: transparent;
    color: var(--gray-600);
    border-color: transparent;
}
.btn--ghost:hover { background-color: var(--gray-100); color: var(--gray-800); }

.btn--link {
    background: none;
    color: var(--primary-600);
    padding: 0;
}
.btn--link:hover { text-decoration: underline; }

.btn--small {
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-xs);
}

.btn--large {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-base);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1.5;
}

.badge--small {
    font-size: 0.65rem;
    padding: 0.1rem 0.5rem;
}

.badge--success { background-color: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.badge--danger  { background-color: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.badge--warning { background-color: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.badge--info    { background-color: var(--info-bg); color: var(--info-text); border: 1px solid var(--info-border); }
.badge--default { background-color: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    font-size: var(--font-size-sm);
}

.alert--info { background-color: var(--info-bg); border-color: var(--info-border); color: var(--primary-800); }
.alert--success { background-color: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.alert--error { background-color: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }

/* ==========================================================================
   5. FORMS
   ========================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-grid--stacked {
    max-width: 800px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-700);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: var(--font-size-sm);
    font-family: var(--font-sans);
    line-height: 1.5;
    color: var(--gray-900);
    background-color: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: var(--transition-base);
    appearance: none; /* Remove default styling */
}

/* Custom Select Arrow */
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

input::placeholder { color: var(--gray-400); }

.form-help {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Filters Bar */
.filters {
    background-color: var(--gray-50);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.filters label {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

/* ==========================================================================
   6. TABLES
   ========================================================================== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
    text-align: left;
}

thead {
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

th {
    padding: 1rem 1.5rem; /* Increased padding */
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    font-size: 0.75rem; /* Increased from 0.7rem */
    letter-spacing: 0.05em;
}

td {
    padding: 1rem 1.5rem; /* Increased padding */
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background-color: var(--gray-50); }

.table__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ==========================================================================
   TABLE SORTING
   ========================================================================== */
th[data-sortable] {
    cursor: pointer;
    position: relative;
    padding-right: 1.5rem; /* Space for icon */
    user-select: none;
    transition: background-color 0.2s;
}

th[data-sortable]:hover {
    background-color: var(--gray-100);
}

th[data-sortable]::after {
    content: '';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.2em;
    height: 1.2em;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 9l4-4 4 4m0 6l-4 4-4-4' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.7;
}

th[data-sortable].sort-asc::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23820303' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 15l7-7 7 7' /%3E%3C/svg%3E");
    opacity: 1;
}

th[data-sortable].sort-desc::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23820303' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7' /%3E%3C/svg%3E");
    opacity: 1;
}

/* ==========================================================================
   7. UTILITIES & EXTRAS
   ========================================================================== */
.text-muted { color: var(--gray-500) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.layout-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.side-panels {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel {
    background: var(--gray-50);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.panel h2 {
    font-size: var(--font-size-base);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

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

.list li {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}
.list li:last-child { border-bottom: none; padding-bottom: 0; }

/* Contact Card */
.contact-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-left: 3px solid var(--primary-500);
    padding: 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition-base);
}
.contact-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Checkbox Group */
.checkbox-group {
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.action-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    color: var(--gray-900);
    position: relative; /* For controls positioning */
}

.action-card:hover {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--primary-600);
}

.action-card__icon {
    font-size: 2rem;
    color: var(--primary-500);
    background-color: var(--primary-50);
    padding: 0.75rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.action-card:hover .action-card__icon {
    background-color: var(--primary-500);
    color: white;
}

.action-card__title {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Action Card Controls */
.action-card .widget-controls {
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--gray-200);
}

/* Drawer Tabs */
.drawer-tabs {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary-600);
}

.tab-btn.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
    font-weight: 600;
}

.drawer-tab-content {
    display: none;
}

.drawer-tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ==========================================================================
   8. RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
    .layout-split { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .app-shell { flex-direction: column; }
    .sidebar { 
        position: relative; 
        width: 100%; 
        height: auto; 
        flex-direction: row; 
        overflow-x: auto;
        padding: 0;
    }
    .sidebar__header { display: none; }
    .sidebar__nav { 
        flex-direction: row; 
        padding: 0.5rem; 
        width: 100%;
    }
    .sidebar__nav a { white-space: nowrap; }
    .main-content { margin-left: 0; }
    .topbar { padding: 0 1rem; }
    .content-area { padding: 1rem; }
}

/* ==========================================================================
   9. GRUPO TABS & PANELS
   ========================================================================== */
.grupo-tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.grupo-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--gray-500);
    font-weight: 500;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
}

.grupo-tab:hover {
    color: var(--primary-600);
}

.grupo-tab.is-active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
}

.grupo-tab i {
    font-size: 1.25em;
}

.grupo-panel {
    display: none;
}

.grupo-panel.is-active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.grupo-general-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.general-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.general-card__icon-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--gray-900);
    font-size: var(--font-size-lg);
}

.general-card__icon-wrapper i {
    color: var(--primary-500);
    font-size: 1.25em;
}

.general-card__description {
    margin: 0;
    color: var(--gray-500);
    font-size: var(--font-size-sm);
}

.general-card__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.general-card__grid .full {
    grid-column: 1 / -1;
}

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

/* ==========================================================================
   10. DASHBOARD WIDGETS (REDESIGN)
   ========================================================================== */
.dashboard-container {
    display: flex;
    gap: 2rem;
    position: relative;
    transition: all 0.3s ease;
}

.dashboard-content {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
}

/* Edit Mode Layout Shift */
.dashboard-container.is-editing .dashboard-content {
    margin-right: 320px; /* Space for drawer */
}

.dashboard-container.is-editing .card {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
}

.dashboard-container.is-editing .card__header,
.dashboard-container.is-editing .dashboard-header-row,
.dashboard_container.is-editing .dashboard-section-title {
    display: none !important;
}

.dashboard-container.is-editing .edit-mode-header {
    display: block !important;
}

/* Widget Drawer (Side Panel) */
.widget-drawer {
    position: fixed;
    top: var(--header-height);
    right: -350px;
    width: 320px;
    height: calc(100vh - var(--header-height));
    background: white;
    border-left: 1px solid var(--gray-200);
    z-index: 90;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.widget-drawer.is-open {
    right: 0;
    box-shadow: -4px 0 15px rgba(0,0,0,0.05);
}

.widget-drawer__header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.widget-drawer__header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.widget-drawer__content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: var(--gray-50);
}

.widget-drawer__footer {
    padding: 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: white;
}

/* Stat Card Redesign */
.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--gray-200);
    position: relative;
    transition: all 0.2s ease;
    height: 100%;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.stat-card__icon-wrapper {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Corporate Colors for Icons */
.stat-card__icon-wrapper--blue { background-color: #eff6ff; color: #2563eb; }
.stat-card__icon-wrapper--green { background-color: #ecfdf5; color: #059669; }
.stat-card__icon-wrapper--red { background-color: #fef2f2; color: #dc2626; }
.stat-card__icon-wrapper--orange { background-color: #fff7ed; color: #ea580c; }

.stat-card__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    flex: 1;
}

.stat-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.stat-card__description {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Edit Mode Controls */
.widget-controls {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.25rem;
    border-radius: 4px;
}

.widget-controls .btn-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--gray-400);
    cursor: pointer;
    border: none;
    background: transparent;
}

.widget-controls .btn-icon:hover {
    background-color: var(--gray-100);
    color: var(--danger-text);
}

.widget-controls .drag-handle {
    cursor: grab;
    color: var(--gray-400);
    display: flex;
    align-items: center;
}

/* Sidebar Widget Item (Ghost) */
.widget-item-preview {
    background: white;
    border: 1px dashed var(--primary-300);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.widget-item-preview:hover {
    border-color: var(--primary-500);
    background-color: var(--primary-50);
}

.widget-item-preview .add-icon {
    margin-left: auto;
    color: var(--primary-500);
}
/* ==========================================================================
   EMAIL LINKS
   ========================================================================== */
.email-link {
    color: var(--info-text);
    text-decoration: none;
    transition: var(--transition-base);
}

.email-link:hover {
    color: var(--primary-600);
    text-decoration: underline;
}

.email-link:visited {
    color: var(--info-text);
}

/* Email links dentro de tablas */
.table .email-link {
    color: inherit;
}

.table .email-link:hover {
    color: var(--primary-600);
}