/* Associa - Clean minimal CSS */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-900);
    background: #f5f6f8;
    min-height: 100vh;
}

/* NAV */
.navbar {
    background: var(--gray-900);
    color: #fff;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand a { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.nav-links { display: flex; list-style: none; gap: .15rem; }
.nav-links a { color: var(--gray-400); text-decoration: none; padding: .45rem .85rem; border-radius: 6px; font-weight: 500; font-size: .88rem; transition: all .15s; }
.nav-links a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-links a.active { color: #fff; background: var(--primary); }

/* LOADING */
.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 9999; transition: opacity .2s; }
.loading-overlay.loading-hidden { opacity: 0; pointer-events: none; visibility: hidden; }
.loading-content { background: #fff; padding: 2rem 2.5rem; border-radius: 12px; text-align: center; box-shadow: var(--shadow-md); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto .75rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-container { margin-top: .75rem; }
.progress-bar-animated { width: 180px; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; margin: 0 auto; }
.progress-fill-animated { height: 100%; background: var(--primary); width: 0%; transition: width .3s; }
.progress-text { font-size: .8rem; color: var(--gray-500); margin-top: .35rem; }

/* TOAST */
.toast-container { position: fixed; top: 64px; right: 16px; z-index: 9998; display: flex; flex-direction: column; gap: .4rem; }
.toast { display: flex; align-items: center; gap: .5rem; padding: .75rem 1rem; background: #fff; border-radius: 8px; box-shadow: var(--shadow-md); transform: translateX(120%); transition: transform .25s; min-width: 280px; max-width: 400px; font-size: .85rem; }
.toast.show { transform: translateX(0); }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
.toast-message { flex: 1; color: var(--gray-700); }
.toast-close { background: none; border: none; font-size: 1.1rem; color: var(--gray-400); cursor: pointer; padding: 0; line-height: 1; }

/* CONTAINER */
.container { max-width: 1300px; margin: 0 auto; padding: 1.5rem 2rem; }

/* HEADINGS */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin-bottom: 1.25rem; display: flex; align-items: center; gap: .5rem; }
h1::before { content: ''; width: 3px; height: 1.25rem; background: var(--primary); border-radius: 2px; }
.page-header h1 { display: block; margin-bottom: .5rem; }
.page-header h1::before { display: none; }

/* CARDS */
.card { background: #fff; border-radius: 10px; padding: 1.25rem; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); }
.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--gray-800); display: flex; align-items: center; gap: .4rem; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: 10px; padding: 1.25rem; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--primary); }
.stat-card:nth-child(2)::before { background: var(--success); }
.stat-card:nth-child(3)::before { background: var(--info); }
.stat-card:nth-child(4)::before { background: var(--warning); }
.stat-card h3 { font-size: .78rem; font-weight: 500; color: var(--gray-500); margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-number { font-size: 2rem; font-weight: 800; color: var(--gray-900); }

/* GRID */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
@media (max-width: 1024px) { .grid-2 { grid-template-columns: 1fr; } }

/* TABLE */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--gray-100); }
.table th { font-weight: 600; color: var(--gray-600); background: var(--gray-50); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.table th:first-child { border-radius: 6px 0 0 0; }
.table th:last-child { border-radius: 0 6px 0 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--gray-50); }
.table td:first-child { font-weight: 500; }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: .2rem .6rem; font-size: .72rem; font-weight: 600; border-radius: 9999px; background: var(--gray-100); color: var(--gray-600); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem 1rem; font-size: .85rem; font-weight: 600; text-decoration: none; border: none; border-radius: 6px; background: #fff; color: var(--gray-700); cursor: pointer; transition: all .15s; box-shadow: inset 0 0 0 1px var(--gray-200); }
.btn:hover { background: var(--gray-50); box-shadow: inset 0 0 0 1px var(--gray-300); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: none; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; box-shadow: none; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }
.btn-link { background: none; box-shadow: none; color: var(--primary); padding: .4rem; }
.btn-link:hover { background: var(--gray-50); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; }

/* FORMS */
.filter-group { display: flex; flex-direction: column; gap: .25rem; }
.filter-group label { font-size: .78rem; font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: .04em; }
.filter-group input, .filter-group select { padding: .5rem .75rem; border: 1px solid var(--gray-200); border-radius: 6px; font-size: .85rem; min-width: 140px; background: #fff; transition: border-color .15s; }
.filter-group input:focus, .filter-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.12); }

/* DETAIL LIST */
.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: .75rem; }
.detail-list dt { font-weight: 600; color: var(--gray-500); font-size: .82rem; }
.detail-list dd { color: var(--gray-900); }

/* TAGS */
.tag { display: inline-block; padding: .2rem .5rem; font-size: .72rem; background: var(--gray-100); color: var(--gray-600); border-radius: 4px; margin-right: .25rem; margin-bottom: .25rem; font-weight: 500; }

/* PROGRESS BAR */
.progress-bar { display: inline-block; width: 80px; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; margin-right: .4rem; vertical-align: middle; }
.progress-fill { height: 100%; background: var(--success); transition: width .3s; }

/* PAGINATION */
.pagination { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--gray-200); }
.page-info { color: var(--gray-500); font-size: .85rem; }

/* ACTIONS */
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* FLASH */
.flash-messages { margin-bottom: 1rem; }
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: .5rem; font-size: .88rem; }
.flash-success { background: var(--success-light); color: #065f46; border-left: 3px solid var(--success); }
.flash-error { background: var(--danger-light); color: #991b1b; border-left: 3px solid var(--danger); }
.flash-warning { background: var(--warning-light); color: #92400e; border-left: 3px solid var(--warning); }
.flash-info { background: var(--info-light); color: #0e7490; border-left: 3px solid var(--info); }

/* UTILS */
.text-muted { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.mt-4 { margin-top: 1.25rem; }
.hidden { display: none !important; }

/* DATA PREVIEW */
.data-preview { font-family: var(--font-mono); font-size: .72rem; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 4px; padding: .4rem .6rem; white-space: pre-wrap; word-break: break-all; max-height: 80px; overflow: hidden; color: var(--gray-700); margin: 0; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; color: var(--gray-500); }
.empty-state h3 { font-size: 1rem; color: var(--gray-700); margin-bottom: .35rem; }

/* FOOTER */
.footer { text-align: center; padding: 1.5rem; color: var(--gray-500); font-size: .82rem; margin-top: 2rem; }
.footer a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ANIMATIONS */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.animate-pulse { animation: pulse 2s infinite; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; flex-wrap: wrap; height: auto; padding: .75rem 1rem; gap: .75rem; }
    .nav-links { width: 100%; justify-content: center; flex-wrap: wrap; }
    .container { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-number { font-size: 1.5rem; }
}
