html, body { height: 100%; }
* { -webkit-tap-highlight-color: transparent; }
body { font-feature-settings: 'cv11','ss01','ss03'; }

/* Toast */
#toast-root { position: fixed; top: 1rem; right: 1rem; z-index: 80; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast { background: #0f172a; color: white; padding: .65rem 1rem; border-radius: .5rem; font-size: .825rem; box-shadow: 0 10px 30px rgba(0,0,0,.18); opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; pointer-events: auto; max-width: 360px; display: flex; align-items: center; gap: .5rem; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: #b91c1c; }
.toast-warn  { background: #b45309; }
.toast-ok    { background: #065f46; }

/* Modal */
#modal-root .modal-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(4px); animation: fadeIn .15s ease; }
.modal { background: white; border-radius: .85rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 760px; max-height: 92vh; overflow: auto; animation: modalIn .2s ease; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes modalIn { from{opacity:0; transform: translateY(10px) scale(.98)} to{opacity:1; transform: translateY(0) scale(1)} }

/* Nav */
.nav-link { display: flex; align-items: center; gap: .55rem; padding: .55rem .75rem; border-radius: .5rem; color: #475569; font-size: .875rem; font-weight: 500; cursor: pointer; }
.nav-link:hover { background: #f1f5f9; color: #0f172a; }
.nav-link.active { background: #eef2ff; color: #4338ca; }
.nav-link.active i { color: #4f46e5; }
.nav-link .count { margin-left: auto; background: white; color: #4338ca; font-size: .65rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; border: 1px solid #e0e7ff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .85rem; border-radius: .5rem; font-size: .875rem; font-weight: 500; transition: background .15s, color .15s, border-color .15s, transform .05s; cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.btn:active { transform: translateY(0.5px); }
.btn-primary { background: #4f46e5; color: white; }
.btn-primary:hover { background: #4338ca; }
.btn-secondary { background: white; color: #334155; border-color: #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }
.btn-danger { background: white; color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-icon { padding: .4rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Form */
.input, .select, .textarea { width: 100%; padding: .5rem .75rem; border-radius: .5rem; border: 1px solid #e2e8f0; background: white; font-size: .875rem; color: #0f172a; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.textarea { min-height: 90px; resize: vertical; font-family: inherit; }
.label { display: block; font-size: .7rem; font-weight: 600; color: #475569; margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .04em; }

/* Cards */
.card { background: white; border: 1px solid #e2e8f0; border-radius: .75rem; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; }
.tab { padding: .7rem 1rem; font-size: .875rem; font-weight: 500; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; background: transparent; border-top: none; border-left: none; border-right: none; }
.tab:hover { color: #0f172a; }
.tab.active { color: #4338ca; border-bottom-color: #6366f1; }

/* Status badges */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 600; line-height: 1.2; }
.status-nouveau       { background: #eef2ff; color: #4338ca; }
.status-a_contacter   { background: #fef3c7; color: #92400e; }
.status-contacte      { background: #dbeafe; color: #1e40af; }
.status-en_discussion { background: #fae8ff; color: #86198f; }
.status-qualifie      { background: #d1fae5; color: #065f46; }
.status-gagne         { background: #bbf7d0; color: #166534; }
.status-perdu         { background: #fee2e2; color: #991b1b; }

.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot-nouveau       { background: #6366f1; }
.dot-a_contacter   { background: #f59e0b; }
.dot-contacte      { background: #3b82f6; }
.dot-en_discussion { background: #c026d3; }
.dot-qualifie      { background: #10b981; }
.dot-gagne         { background: #16a34a; }
.dot-perdu         { background: #ef4444; }

/* Source chips */
.source-chip { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 600; }
.source-entreprises { background: #cffafe; color: #155e75; }
.source-github      { background: #e2e8f0; color: #0f172a; }
.source-reddit      { background: #ffedd5; color: #9a3412; }
.source-hn          { background: #fef3c7; color: #854d0e; }

/* Kanban */
.kanban-wrap { overflow-x: auto; padding-bottom: 1rem; }
.kanban { display: grid; grid-template-columns: repeat(7, 260px); gap: .75rem; }
.kanban-col { background: #f1f5f9; border-radius: .75rem; padding: .65rem; display: flex; flex-direction: column; min-height: 60vh; }
.kanban-col h3 { font-size: .8rem; font-weight: 700; color: #334155; margin-bottom: .5rem; display: flex; align-items: center; gap: .45rem; }
.kanban-col h3 .ct { margin-left: auto; background: white; padding: .05rem .45rem; border-radius: 999px; font-size: .65rem; color: #64748b; border: 1px solid #e2e8f0; }
.kanban-cards { flex: 1; min-height: 40px; }
.kanban-card { background: white; border-radius: .55rem; padding: .65rem; margin-bottom: .5rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); border: 1px solid #e2e8f0; cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .35; }
.kanban-col.drop-over { background: #e0e7ff; outline: 2px dashed #6366f1; outline-offset: -2px; }
.kanban-card .ttl { font-weight: 600; font-size: .825rem; color: #0f172a; line-height: 1.3; }
.kanban-card .sub { font-size: .75rem; color: #64748b; margin-top: .15rem; line-height: 1.3; }

/* Tags */
.tag { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: 999px; font-size: .7rem; background: #f1f5f9; color: #334155; }
.tag .x { cursor: pointer; opacity: .55; }
.tag .x:hover { opacity: 1; }

/* Empty / loading */
.empty { padding: 3rem 1rem; text-align: center; color: #94a3b8; }
.empty i { font-size: 2.75rem; margin-bottom: .5rem; display: block; color: #cbd5e1; }
.spinner { width: 1rem; height: 1rem; border: 2px solid #e2e8f0; border-top-color: #6366f1; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.spinner-lg { width: 2rem; height: 2rem; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Result row */
.res { display: flex; gap: .85rem; padding: .85rem; border-bottom: 1px solid #f1f5f9; align-items: flex-start; }
.res:last-child { border-bottom: none; }
.res:hover { background: #fafbfd; }
.res-avatar { width: 38px; height: 38px; border-radius: .5rem; background: #eef2ff; color: #4338ca; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.res-avatar img { width: 100%; height: 100%; object-fit: cover; }
.res-main { flex: 1; min-width: 0; }
.res-ttl { font-weight: 600; color: #0f172a; line-height: 1.3; }
.res-sub { font-size: .8rem; color: #64748b; margin-top: .15rem; }
.res-meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.res-actions { display: flex; gap: .3rem; align-items: center; flex-shrink: 0; }

.meta-chip { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: 999px; font-size: .7rem; background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }

/* Table */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: #64748b; font-weight: 600; padding: .65rem .75rem; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.tbl td { padding: .7rem .75rem; border-bottom: 1px solid #f1f5f9; font-size: .875rem; vertical-align: middle; }
.tbl tr:hover td { background: #f8fafc; }
.tbl tr.selected td { background: #eef2ff; }
.tbl input[type="checkbox"] { accent-color: #4f46e5; }

/* KPI cards */
.kpi { background: white; border: 1px solid #e2e8f0; border-radius: .75rem; padding: 1rem 1.1rem; }
.kpi .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 600; }
.kpi .val { font-size: 1.75rem; font-weight: 700; color: #0f172a; line-height: 1.1; margin-top: .25rem; }
.kpi .sub { font-size: .75rem; color: #64748b; margin-top: .15rem; }

/* Bar chart */
.bar-row { display: grid; grid-template-columns: 140px 1fr 50px; align-items: center; gap: .65rem; padding: .35rem 0; font-size: .8rem; }
.bar-track { background: #f1f5f9; border-radius: 999px; height: 8px; overflow: hidden; }
.bar-fill { background: linear-gradient(90deg, #6366f1, #818cf8); height: 100%; border-radius: 999px; transition: width .4s ease; }

/* Misc */
.scroll-hide::-webkit-scrollbar { display: none; }
a { color: #4338ca; }
a:hover { text-decoration: underline; }
a.btn:hover, a.nav-link:hover { text-decoration: none; }
.kbd { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .7rem; padding: .05rem .35rem; border-radius: .25rem; background: #f1f5f9; border: 1px solid #e2e8f0; color: #475569; }
.divider { height: 1px; background: #e2e8f0; margin: 1rem 0; }
