/* =====================================================
   TelecommPlus — Design System
   Colores dominantes: Blanco + Azul Claro
   ===================================================== */

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

/* ===== CSS Variables ===== */
:root {
    /* Primary - Azul */
    --primary-50:  #EFF6FF;
    --primary-100: #DBEAFE;
    --primary-200: #BFDBFE;
    --primary-300: #93C5FD;
    --primary-400: #60A5FA;
    --primary-500: #3B82F6;
    --primary-600: #2563EB;
    --primary-700: #1D4ED8;
    --primary-800: #1E40AF;
    --primary-900: #1E3A8A;

    /* Neutrals */
    --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;

    /* Status Colors */
    --status-pending:    #F59E0B;
    --status-pending-bg: #FEF3C7;
    --status-open:       #3B82F6;
    --status-open-bg:    #DBEAFE;
    --status-not-done:   #EF4444;
    --status-not-done-bg:#FEE2E2;
    --status-complete:   #10B981;
    --status-complete-bg:#D1FAE5;

    /* Semantic */
    --success: #10B981;
    --warning: #F59E0B;
    --danger:  #EF4444;
    --info:    #3B82F6;

    /* Surfaces */
    --bg-body:      #F0F4F8;
    --bg-surface:   #FFFFFF;
    --bg-sidebar:   rgba(255, 255, 255, 0.85);
    --bg-header:    rgba(255, 255, 255, 0.92);
    
    /* Text */
    --text-primary:   #1E293B;
    --text-secondary: #64748B;
    --text-muted:     #94A3B8;
    --text-inverse:   #FFFFFF;

    /* Borders */
    --border-light:  #E2E8F0;
    --border-medium: #CBD5E1;

    /* Shadows */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --shadow-blue: 0 4px 14px rgba(59,130,246,0.25);

    /* Radius */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --radius-xl:   20px;
    --radius-full: 9999px;

    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;

    /* Transitions */
    --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow:   350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    font-size: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: 0.9375rem;
}

img { max-width: 100%; }

/* ===== Layout ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-normal);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-main.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed);
}

.app-content {
    flex: 1;
    padding: 28px 32px;
    margin-top: var(--header-height);
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-light);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal), transform var(--transition-normal);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-brand {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
    min-height: 72px;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-blue);
}

.sidebar-brand-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-fast);
}

.sidebar-brand-text span {
    color: var(--primary-600);
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-link-text,
.sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 16px 12px 6px;
    white-space: nowrap;
    transition: opacity var(--transition-fast);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 2px 0;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
    cursor: pointer;
}

.sidebar-link:hover {
    background: var(--primary-50);
    color: var(--primary-700);
}

.sidebar-link.active {
    background: var(--primary-100);
    color: var(--primary-700);
    font-weight: 600;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-600);
    border-radius: 0 4px 4px 0;
}

.sidebar-link-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-link-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}

.sidebar-link-badge {
    margin-left: auto;
    background: var(--primary-500);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sidebar-user:hover {
    background: var(--gray-50);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
    transition: opacity var(--transition-fast);
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    transition: left var(--transition-normal);
}

.header.sidebar-collapsed {
    left: var(--sidebar-collapsed);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.header-toggle-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.header-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.header-icon-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.header-icon-btn svg {
    width: 20px;
    height: 20px;
}

.header-icon-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header-left h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.page-header-left p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 22px;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Stat Cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-xs);
}

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

.stat-card-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon.blue    { background: var(--primary-100); color: var(--primary-600); }
.stat-card-icon.green   { background: #D1FAE5; color: #059669; }
.stat-card-icon.yellow  { background: #FEF3C7; color: #D97706; }
.stat-card-icon.red     { background: #FEE2E2; color: #DC2626; }
.stat-card-icon.purple  { background: #EDE9FE; color: #7C3AED; }

.stat-card-icon svg {
    width: 22px;
    height: 22px;
}

.stat-card-info {
    flex: 1;
}

.stat-card-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card-change {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
}
.stat-card-change.up   { color: var(--success); }
.stat-card-change.down { color: var(--danger); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::after {
    opacity: 0.08;
}

.btn:active {
    transform: scale(0.97);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: var(--shadow-blue);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    box-shadow: 0 6px 20px rgba(59,130,246,0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}
.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-ghost {
    color: var(--text-secondary);
    padding: 8px 14px;
}
.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

.btn:disabled, .btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

.btn.loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ===== Forms ===== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-medium);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.form-input.error,
.form-select.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

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

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-switch input[type="checkbox"] {
    display: none;
}

.form-switch-track {
    width: 44px;
    height: 24px;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    position: relative;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.form-switch input:checked + .form-switch-track {
    background: var(--primary-500);
}

.form-switch-track::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.form-switch input:checked + .form-switch-track::after {
    transform: translateX(20px);
}

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.data-table th:hover {
    color: var(--primary-600);
}

.data-table th.sorted {
    color: var(--primary-700);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--primary-50);
}

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

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-light);
}

.table-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-50);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0 12px;
    flex: 1;
    max-width: 320px;
    transition: all var(--transition-fast);
}

.table-search:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
    background: white;
}

.table-search svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.table-search input {
    border: none;
    background: none;
    padding: 9px 0;
    width: 100%;
    outline: none;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.table-filters {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.table-pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.table-pagination-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.table-pagination-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.table-pagination-btn.active {
    background: var(--primary-500);
    color: white;
}

.table-pagination-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ===== Status Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pending {
    background: var(--status-pending-bg);
    color: #92400E;
}

.badge-open, .badge-abierta {
    background: var(--status-open-bg);
    color: #1E40AF;
}

.badge-not-done {
    background: var(--status-not-done-bg);
    color: #991B1B;
}

.badge-complete, .badge-completa {
    background: var(--status-complete-bg);
    color: #065F46;
}

.badge-active {
    background: #D1FAE5;
    color: #065F46;
}

.badge-inactive {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-normal);
}

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

.modal.modal-lg {
    max-width: 860px;
}

.modal.modal-xl {
    max-width: 1080px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}

.toast {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid var(--primary-500);
    animation: toastIn 0.3s ease-out;
    position: relative;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon   { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 1rem;
}

.toast-close:hover {
    background: var(--gray-100);
}

.toast.removing {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progressShine 1.5s infinite;
}

@keyframes progressShine {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* ===== File Upload ===== */
.file-upload-zone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--gray-50);
}

.file-upload-zone:hover,
.file-upload-zone.dragover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.file-upload-zone svg {
    width: 48px;
    height: 48px;
    color: var(--primary-400);
    margin-bottom: 12px;
}

.file-upload-zone h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.file-upload-zone p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-upload-zone .highlight {
    color: var(--primary-600);
    font-weight: 600;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

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

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

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-50) 0%, #E0ECFF 40%, var(--bg-body) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
    top: -100px;
    right: -100px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,0.06) 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
}

.login-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    animation: loginFadeIn 0.6s ease-out;
}

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

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.4rem;
    box-shadow: var(--shadow-blue);
}

.login-logo-text {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

.login-logo-text span {
    color: var(--primary-600);
}

.login-subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form .form-input {
    padding: 12px 16px;
    font-size: 0.95rem;
}

.login-btn {
    width: 100%;
    padding: 13px;
    font-size: 0.95rem;
    margin-top: 6px;
}

.login-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #991B1B;
    display: none;
    animation: shakeX 0.4s ease;
}

.login-error.show {
    display: block;
}

@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ===== Skeleton Loading ===== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 22px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

/* ===== Account Detail (Ficha Técnica) ===== */
.account-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.account-detail-field {
    padding: 10px 0;
}

.account-detail-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.account-detail-field span {
    font-size: 0.925rem;
    color: var(--text-primary);
    font-weight: 500;
}

.account-detail-field.full-width {
    grid-column: 1 / -1;
}

.notes-timeline {
    margin-top: 20px;
}

.note-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.note-item:last-child {
    border-bottom: none;
}

.note-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-100);
    color: var(--primary-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.note-content {
    flex: 1;
}

.note-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.note-author {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.note-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.note-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
}

.note-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.note-text.system-note {
    font-style: italic;
    color: var(--text-muted);
}

/* ===== Dropdown Menu ===== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
    padding: 4px;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--gray-50);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .app-main {
        margin-left: 0 !important;
    }
    
    .header {
        left: 0 !important;
    }
    
    .app-content {
        padding: 20px 16px;
    }
    
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .account-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: var(--radius-lg);
    }
    
    .login-card {
        padding: 32px 24px;
        margin: 16px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
    
    .table-toolbar {
        flex-direction: column;
    }
    
    .table-search {
        max-width: 100%;
    }
}

/* ===== Utility Classes ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-secondary); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }

/* Filas con prioridad (fecha = hoy) */
.data-table tr.highlight-green { background-color: var(--status-complete-bg) !important; }
.data-table tr.highlight-green:hover { background-color: #bef2d9 !important; }
