/* =========================================================
   FINORA — Premium Dark Theme
   Inspirado em Linear, Vercel, Raycast, Stripe Dashboard
   ========================================================= */

:root {
    --bg-base: #09090B;
    --bg-elevated: #0F0F12;
    --bg-card: #111114;
    --bg-card-hover: #16161A;
    --bg-input: #0C0C0F;

    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.10);
    --border-bright: rgba(255, 255, 255, 0.18);

    --text-primary: #FAFAFA;
    --text-secondary: #A1A1AA;
    --text-tertiary: #71717A;
    --text-quaternary: #52525B;

    --accent: #8B5CF6;
    --accent-hover: #A78BFA;
    --accent-glow: rgba(139, 92, 246, 0.25);

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

    --shadow-card: 0 0 0 1px rgba(255,255,255,0.04), 0 8px 24px -4px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 40px -8px var(--accent-glow);
}

/* =========================================================
   Fontes — Inter Tight + JetBrains Mono
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
    letter-spacing: -0.011em;
}

body {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(139, 92, 246, 0.07), transparent 60%),
        radial-gradient(900px 600px at -10% 30%, rgba(59, 130, 246, 0.04), transparent 60%),
        var(--bg-base);
    min-height: 100vh;
}

.font-mono { font-family: 'JetBrains Mono', monospace; font-feature-settings: 'cv02', 'cv03'; }
.font-display { font-family: 'Inter Tight', sans-serif; letter-spacing: -0.025em; font-weight: 700; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }

/* =========================================================
   Cards
   ========================================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
}
.card-hover:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.card-glow {
    background: linear-gradient(180deg, rgba(139,92,246,0.04) 0%, transparent 100%), var(--bg-card);
    border: 1px solid rgba(139,92,246,0.15);
    box-shadow: 0 0 0 1px rgba(139,92,246,0.08), 0 8px 32px -8px rgba(139,92,246,0.15);
}

/* =========================================================
   Inputs
   ========================================================= */
.input, .select, .textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.15s ease;
    outline: none;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: rgba(139,92,246,0.4);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}
.input::placeholder { color: var(--text-quaternary); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.textarea { resize: vertical; min-height: 90px; }

.label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.01em; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(180deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    box-shadow: 0 0 0 1px rgba(139,92,246,0.4), 0 1px 0 rgba(255,255,255,0.1) inset, 0 8px 16px -4px rgba(139,92,246,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(167,139,250,0.5), 0 1px 0 rgba(255,255,255,0.15) inset, 0 12px 24px -6px rgba(139,92,246,0.4); }
.btn-secondary { background: rgba(255,255,255,0.04); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: rgba(255,255,255,0.08); border-color: var(--border-bright); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.btn-danger { background: rgba(239,68,68,0.1); color: #FCA5A5; border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.18); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 8px; }

/* =========================================================
   Sidebar
   ========================================================= */
.sidebar {
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(12px);
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
    text-decoration: none;
    position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.nav-active {
    background: linear-gradient(90deg, rgba(139,92,246,0.12) 0%, rgba(139,92,246,0.04) 100%);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(139,92,246,0.15);
}
.nav-active::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 18px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* =========================================================
   Topbar
   ========================================================= */
.topbar {
    background: rgba(9, 9, 11, 0.7);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

/* =========================================================
   Tags / Badges / Pills
   ========================================================= */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid;
    letter-spacing: 0.01em;
}
.dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    display: inline-block;
}

/* =========================================================
   Stat cards
   ========================================================= */
.stat-card { position: relative; overflow: hidden; padding: 22px; }
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(400px 200px at 100% 0%, rgba(255,255,255,0.025), transparent 50%);
    pointer-events: none;
}
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; font-family: 'Inter Tight'; }
.stat-label { font-size: 12.5px; color: var(--text-tertiary); font-weight: 500; }

/* =========================================================
   Tables
   ========================================================= */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 500; color: var(--text-tertiary); padding: 12px 16px; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.05em; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text-primary); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.15s ease; }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* =========================================================
   Modals
   ========================================================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 28px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px -12px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
}

/* =========================================================
   Toasts
   ========================================================= */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 13.5px;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.25s ease;
}
.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); }

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

/* =========================================================
   Progress bars
   ========================================================= */
.progress-track {
    height: 6px;
    background: rgba(255,255,255,0.04);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, #A78BFA 100%);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(139,92,246,0.4);
}

/* =========================================================
   Skeleton loading
   ========================================================= */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =========================================================
   Empty states
   ========================================================= */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}
.empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--text-tertiary);
}

/* =========================================================
   Animations
   ========================================================= */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.stagger > * { opacity: 0; animation: stagger 0.4s ease forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }

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

/* =========================================================
   Grain texture overlay (sutil)
   ========================================================= */
.grain::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: overlay;
}

/* =========================================================
   Kanban
   ========================================================= */
.kanban-col {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    min-height: 400px;
}
.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 12px;
    cursor: grab;
    transition: all 0.15s ease;
}
.kanban-card:hover { transform: translateY(-2px); border-color: var(--border-bright); }

/* =========================================================
   Auth screen
   ========================================================= */
.auth-bg {
    background:
        radial-gradient(800px 600px at 50% -20%, rgba(139,92,246,0.18), transparent 60%),
        radial-gradient(600px 400px at 80% 100%, rgba(59,130,246,0.08), transparent 60%),
        var(--bg-base);
    min-height: 100vh;
}

.auth-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%), var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 32px 80px -16px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
}

/* =========================================================
   Glow accents
   ========================================================= */
.glow-purple { box-shadow: 0 0 30px -6px rgba(139,92,246,0.3); }
.glow-green { box-shadow: 0 0 30px -6px rgba(16,185,129,0.3); }
.glow-red { box-shadow: 0 0 30px -6px rgba(239,68,68,0.3); }

/* =========================================================
   Utility
   ========================================================= */
.bg-grid {
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 32px 32px;
}

[x-cloak] { display: none !important; }

/* Icon size default */
.lucide { width: 18px; height: 18px; stroke-width: 1.75; flex-shrink: 0; }
.icon-sm { width: 14px !important; height: 14px !important; }
.icon-lg { width: 24px !important; height: 24px !important; }
.icon-xl { width: 32px !important; height: 32px !important; }
