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

/* ========== BASE ========== */
:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --gradient: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
    --bg: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.65);
    --bg-alt: rgba(241, 245, 249, 0.8);
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --border: rgba(255, 255, 255, 0.4);
    --border-light: rgba(255, 255, 255, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.08);
    /* Priority colors */
    --critical: #ef4444;
    --high: #f97316;
    --medium: #3b82f6;
    --low: #10b981;
    --glass-blur: 16px;
}

.dark {
    --bg: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.6);
    --bg-alt: rgba(15, 23, 42, 0.6);
    --text: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.03);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    transition: background 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

.font-outfit { font-family: 'Outfit', sans-serif; }

/* ========== BACKGROUND SHAPES ========== */
.bg-shapes {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: floatShape 20s infinite alternate ease-in-out;
}
.dark .shape { opacity: 0.3; filter: blur(120px); }

.shape-1 {
    top: -10%; left: -10%;
    width: 50vw; height: 50vw;
    background: #3b82f6;
    animation-delay: 0s;
}
.shape-2 {
    bottom: -20%; right: -10%;
    width: 60vw; height: 60vw;
    background: #8b5cf6;
    animation-delay: -5s;
}
.shape-3 {
    top: 40%; left: 40%;
    width: 40vw; height: 40vw;
    background: #ec4899;
    animation-delay: -10s;
    opacity: 0.3;
}
.dark .shape-3 { opacity: 0.15; }

@keyframes floatShape {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(5%, 10%) scale(1.1); }
    66% { transform: translate(-5%, 5%) scale(0.9); }
    100% { transform: translate(0, -5%) scale(1.05); }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.5); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
.dark ::-webkit-scrollbar-thumb { background: rgba(71, 85, 105, 0.6); border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(100, 116, 139, 0.8); }

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.animate-fade-in-up { animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-fade-in    { animation: fadeIn 0.5s ease-out both; }

/* ========== MAIN CONTAINER ========== */
.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1.5rem 5rem;
    position: relative;
    z-index: 1;
}

/* ========== HERO ========== */
.hero {
    text-align: center;
    margin-bottom: 3.5rem;
}
.hero h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 3rem;
    letter-spacing: -0.02em;
    margin: 0 0 1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 24px rgba(139, 92, 246, 0.15);
}
.hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 760px;
    margin: 0 auto;
    line-height: 1.7;
    font-weight: 400;
}

/* ========== CARD (GLASSMORPHISM) ========== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.6);
}
.dark .card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.card-title i {
    color: var(--primary);
    font-size: 1rem;
}
.dark .card-title i { color: var(--primary-light); }

.card-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ========== FORM ========== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
}
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.form-group label i {
    color: var(--primary);
    font-size: 0.85rem;
}
.dark .form-group label i { color: var(--primary-light); }
.form-group select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-alt);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    transition: all 0.3s ease;
    outline: none;
    width: 100%;
    cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.form-group select:hover {
    border-color: rgba(99, 102, 241, 0.5);
}
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: var(--bg-card);
}

/* Checkbox pills */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    background: var(--bg-card);
    color: var(--text-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.checkbox-pill:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}
.dark .checkbox-pill:hover {
    color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}
.checkbox-pill input { display: none; }
.checkbox-pill.checked {
    background: var(--gradient);
    border-color: transparent;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.dark .checkbox-pill.checked {
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    color: white;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem 1.75rem;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
}
.btn:hover::after {
    left: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 8px;
}
.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-alt);
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1.5px solid #fecaca;
}
.btn-danger:hover { background: #fef2f2; }
.dark .btn-danger {
    border-color: #7f1d1d;
    color: #fca5a5;
}
.dark .btn-danger:hover { background: rgba(127, 29, 29, 0.2); }

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.75rem;
}

/* ========== RESULTS WRAPPER ========== */
.results-wrapper {
    margin-top: 2.5rem;
    animation: fadeInUp 0.6s ease-out both;
}
.results-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.results-actions h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    margin: 0;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-card {
    margin-bottom: 1.5rem;
}

/* ========== MATRIX CHART ========== */
.matrix-container {
    position: relative;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}

.matrix-chart {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-height: 520px;
    background:
        linear-gradient(to right, var(--border) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border) 1px, transparent 1px);
    background-size: 10% 10%;
    border-left: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    border-radius: 8px;
    overflow: visible;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
}

/* Quadrant backgrounds for visual separation */
.quadrant-bg {
    position: absolute;
    width: 50%;
    height: 50%;
    z-index: 0;
    pointer-events: none;
    transition: background 0.3s ease;
}
.q-bg-top-left {
    top: 0;
    left: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, transparent 100%);
    border-radius: 8px 0 0 0;
}
.q-bg-top-right {
    top: 0;
    right: 0;
    background: linear-gradient(225deg, rgba(239, 68, 68, 0.04) 0%, transparent 100%);
    border-radius: 0 8px 0 0;
}
.q-bg-bottom-left {
    bottom: 0;
    left: 0;
    background: linear-gradient(45deg, rgba(148, 163, 184, 0.04) 0%, transparent 100%);
    border-radius: 0 0 0 8px;
}
.q-bg-bottom-right {
    bottom: 0;
    right: 0;
    background: linear-gradient(315deg, rgba(20, 184, 166, 0.04) 0%, transparent 100%);
    border-radius: 0 0 8px 0;
}

.quadrant-label {
    position: absolute;
    font-family: 'Outfit', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 6px;
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.q-top-left    { top: 12px; left: 25%; transform: translateX(-50%); }
.q-top-right   { top: 12px; left: 75%; transform: translateX(-50%); }
.q-bottom-left { bottom: 12px; left: 25%; transform: translateX(-50%); }
.q-bottom-right { bottom: 12px; left: 75%; transform: translateX(-50%); }

.axis-label {
    position: absolute;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow);
    pointer-events: none;
    z-index: 2;
}
.axis-y {
    left: -4rem;
    top: 50%;
    transform: rotate(-90deg) translateX(-50%);
    transform-origin: left center;
}
.axis-x {
    bottom: -2.4rem;
    left: 50%;
    transform: translateX(-50%);
}

/* Matrix divider lines */
.matrix-chart::before,
.matrix-chart::after {
    content: '';
    position: absolute;
    z-index: 0;
}
.matrix-chart::before {
    /* Horizontal center line */
    left: 0; right: 0;
    top: 50%;
    height: 1px;
    border-top: 1px dashed var(--text-faint);
    opacity: 0.5;
}
.matrix-chart::after {
    /* Vertical center line */
    top: 0; bottom: 0;
    left: 50%;
    width: 1px;
    border-left: 1px dashed var(--text-faint);
    opacity: 0.5;
}

.matrix-dot {
    position: absolute;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
    cursor: default;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 2px 4px rgba(255,255,255,0.4);
    transform: translate(-50%, 50%);
    border: 2px solid rgba(255,255,255,0.8);
}
.matrix-dot:hover {
    transform: translate(-50%, 50%) scale(1.25);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25), inset 0 2px 6px rgba(255,255,255,0.6);
    z-index: 3;
}
.matrix-dot .dot-tooltip {
    display: none;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}
.matrix-dot:hover .dot-tooltip {
    display: block;
    animation: fadeInUp 0.2s ease-out;
}

.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}
.legend-item:hover {
    background: var(--bg-card);
    border-color: var(--primary-light);
    transform: translateY(-1px);
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 1px 3px rgba(255,255,255,0.4), 0 2px 4px rgba(0,0,0,0.1);
}

/* ========== SCORES TABLE ========== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.scores-table,
.strategy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: var(--bg-card);
}

.scores-table th,
.strategy-table th {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    backdrop-filter: blur(8px);
}
.dark .scores-table th,
.dark .strategy-table th {
    background: rgba(255, 255, 255, 0.02);
}

.scores-table td,
.strategy-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}
.scores-table td[contenteditable="true"]:focus,
.strategy-table td[contenteditable="true"]:focus,
.edit-legend-name[contenteditable="true"]:focus,
.edit-segmentation-name[contenteditable="true"]:focus,
.profile-name[contenteditable="true"]:focus,
.profile-score-num[contenteditable="true"]:focus,
.segment-desc[contenteditable="true"]:focus {
    background: rgba(99, 102, 241, 0.05);
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.scores-table tbody tr:hover,
.strategy-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.priority-critique {
    background: rgba(239, 68, 68, 0.1);
    color: var(--critical);
}
.priority-haute {
    background: rgba(245, 158, 11, 0.1);
    color: var(--high);
}
.priority-moyenne {
    background: rgba(59, 130, 246, 0.1);
    color: var(--medium);
}
.priority-faible {
    background: rgba(16, 185, 129, 0.1);
    color: var(--low);
}

.score-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.score-bar-track {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    min-width: 50px;
}
.score-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.score-value {
    font-weight: 700;
    font-size: 0.8rem;
    min-width: 2rem;
    text-align: right;
}

/* ========== PROFILE CARDS ========== */
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}
@media (max-width: 480px) {
    .profiles-grid { grid-template-columns: 1fr; }
}

.profile-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}
.profile-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.4);
}
.dark .profile-card:hover {
    border-color: rgba(99, 102, 241, 0.6);
}

.profile-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-light);
    background: rgba(15, 23, 42, 0.02);
}
.dark .profile-header {
    background: rgba(255, 255, 255, 0.02);
}
.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1), inset 0 2px 4px rgba(255,255,255,0.2);
}
.profile-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 0.1rem;
}
.profile-type {
    font-size: 0.82rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.profile-body {
    padding: 1.25rem 1.5rem;
}
.profile-body .profile-field {
    margin-bottom: 1rem;
}
.profile-body .profile-field:last-child {
    margin-bottom: 0;
}
.profile-field-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin-bottom: 0.3rem;
}
.profile-field-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    outline: none;
    border-radius: 6px;
    padding: 0.25rem 0.4rem;
    margin: -0.25rem -0.4rem;
    transition: background 0.3s ease;
}
.profile-field-value:focus {
    background: rgba(99, 102, 241, 0.08);
}

.profile-scores {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: rgba(15, 23, 42, 0.03);
}
.dark .profile-scores {
    background: rgba(255, 255, 255, 0.02);
}
.profile-score-item {
    flex: 1;
    text-align: center;
}
.profile-score-num {
    font-size: 1.25rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}
.profile-score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-faint);
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-top: 0.1rem;
}

/* ========== SEGMENTATION ========== */
.segmentation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.segment-box {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
.segment-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.segment-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    opacity: 0.8;
}
.segment-box h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0 0 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.segment-box .segment-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
    line-height: 1.5;
}
.segment-members {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.03);
    border-radius: 10px;
    padding: 0.5rem 1rem;
}
.dark .segment-members {
    background: rgba(255, 255, 255, 0.02);
}
.segment-members li {
    font-size: 0.85rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.segment-members li:last-child { border-bottom: none; }
.segment-members li i {
    font-size: 0.4rem;
}

/* Segment colors */
.seg-critical { border-color: rgba(239, 68, 68, 0.3); }
.seg-critical:hover { border-color: rgba(239, 68, 68, 0.6); box-shadow: 0 8px 30px rgba(239, 68, 68, 0.15); }
.seg-critical::before { background: var(--critical); }
.seg-critical h4 { color: var(--critical); }

.seg-high { border-color: rgba(249, 115, 22, 0.3); }
.seg-high:hover { border-color: rgba(249, 115, 22, 0.6); box-shadow: 0 8px 30px rgba(249, 115, 22, 0.15); }
.seg-high::before { background: var(--high); }
.seg-high h4 { color: var(--high); }

.seg-medium { border-color: rgba(59, 130, 246, 0.3); }
.seg-medium:hover { border-color: rgba(59, 130, 246, 0.6); box-shadow: 0 8px 30px rgba(59, 130, 246, 0.15); }
.seg-medium::before { background: var(--medium); }
.seg-medium h4 { color: var(--medium); }

.seg-low { border-color: rgba(16, 185, 129, 0.3); }
.seg-low:hover { border-color: rgba(16, 185, 129, 0.6); box-shadow: 0 8px 30px rgba(16, 185, 129, 0.15); }
.seg-low::before { background: var(--low); }
.seg-low h4 { color: var(--low); }

/* ========== SOURCES ========== */
.sources-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.sources-section h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--primary);
    text-decoration: none;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    background: var(--bg-card);
}
.source-link:hover {
    background: #eef2ff;
    border-color: var(--primary);
}
.dark .source-link:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-light);
}

/* ========== EDIT HINT ========== */
.edit-hint {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4f46e5;
    padding: 0.75rem 1.25rem;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}
.edit-hint i {
    font-size: 1rem;
    color: #4f46e5;
}
.dark .edit-hint {
    background: rgba(129, 140, 248, 0.12);
    border-color: rgba(129, 140, 248, 0.3);
    color: #a5b4fc;
}
.dark .edit-hint i {
    color: #a5b4fc;
}

/* ========== EXPORT HEADER ========== */
.export-header {
    display: none;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
}
.export-header .eh-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.export-header .eh-logo {
    width: 36px; height: 36px;
    background: var(--gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
}
.export-header .eh-brand {
    font-family: 'Space Grotesk', monospace;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text);
}
.export-header .eh-brand span { color: #2563eb; }
.export-header .eh-right {
    text-align: right;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.75rem; }
    .hero p { font-size: 0.95rem; }
    .results-actions { flex-direction: column; align-items: flex-start; }
    .matrix-chart { max-height: 360px; }
    .profiles-grid { grid-template-columns: 1fr; }
    .segmentation-grid { grid-template-columns: 1fr; }
}

/* ========== HIDDEN UTIL ========== */
.hidden { display: none !important; }

/* ========== LOADING ========== */
.loading-spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== EXPORT MODE ========== */
body.export-mode {
    --bg-card: #ffffff;
}
.dark body.export-mode {
    --bg-card: #1e293b;
}
body.export-mode .card,
body.export-mode .profile-card,
body.export-mode .segment-box {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
body.export-mode .bg-shapes {
    display: none !important;
}

/* Extracted from index.html */

.grimont-global-header {
    width: 100%;
    z-index: 1000;
    position: sticky;
    top: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 0;
    font-family: 'Outfit', 'Inter', sans-serif;
    color: #e2e8f0;
    box-sizing: border-box;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}
.grimont-global-header * { box-sizing: border-box; }
.grimont-global-header .ggh-container {
    max-width: 1152px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ggh-left { display: flex; align-items: center; gap: 1.5rem; }
.ggh-logo-group {
    display: flex; align-items: center; gap: 0.875rem; text-decoration: none; transition: transform 0.2s ease;
}
.ggh-logo-group:hover { transform: scale(1.02); }
.ggh-logo-box {
    width: 40px; height: 40px; background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: white; font-weight: bold; font-size: 1.25rem; border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.25); flex-shrink: 0;
}
.ggh-logo-text {
    font-family: 'Space Grotesk', monospace; font-weight: 800; font-size: 1.2rem;
    color: white; letter-spacing: 0.05em; display: none;
}
.ggh-logo-text span { color: #00f2ff; }
@media (min-width: 640px) { .ggh-logo-text { display: block; } }
.ggh-separator { width: 1px; height: 36px; background-color: rgba(255, 255, 255, 0.1); display: none; }
@media (min-width: 768px) { .ggh-separator { display: block; } }
.ggh-app-info { display: flex; flex-direction: column; justify-content: center; }
.ggh-app-title-group { display: flex; align-items: center; gap: 0.6rem; }
.ggh-app-icon-container {
    width: 32px; height: 32px; border-radius: 8px; background: rgba(30, 41, 59, 1);
    border: 1px solid rgba(255, 255, 255, 0.1); display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #60a5fa; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); flex-shrink: 0;
}
.ggh-app-name { font-weight: 700; color: white; font-size: 1.05rem; margin: 0; padding: 0; letter-spacing: 0.02em; }
.ggh-app-desc {
    font-size: 0.8rem; color: #94a3b8; max-width: 600px;
     display: none; margin: 4px 0 0 0; padding: 0; line-height: 1.4; font-weight: 300;
}
@media (min-width: 1024px) { .ggh-app-desc { display: block; } }
.ggh-right { display: flex; align-items: center; gap: 1rem; }
.ggh-right button {
    background: rgba(30, 41, 59, 0.6) !important; border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #cbd5e1 !important; width: 40px !important; height: 40px !important;
    border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important;
    cursor: pointer !important; transition: all 0.2s ease !important; padding: 0 !important; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}
.ggh-right button:hover {
    background: rgba(30, 41, 59, 1) !important; color: white !important; border-color: rgba(255, 255, 255, 0.2) !important; transform: translateY(-1px) !important;
}

