/* ================================================
   REGISTERS — Design System v3 — Vert Registre & Or
   ================================================ */

:root {
    /* Neutrals */
    --bg:        #f5f2ee;
    --surface:   #ffffff;
    --surface-2: #f9f6f2;
    --ink:       #1a1a2e;
    --ink-2:     #3d3a50;
    --muted:     #6b7280;
    --border:    #e4ded7;
    --border-2:  #d4cec7;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
    --shadow-sm: 0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow:    0 4px 20px rgba(0,0,0,.10);
    --shadow-lg: 0 8px 40px rgba(0,0,0,.14);

    /* Brand */
    --brand:     #1e4d3a;

    /* Domain — Entreprises (vert forêt) */
    --co:        #1e4d3a;
    --co-lt:     #eef5f1;
    --co-bd:     #a3c5b4;
    --co-dk:     #163829;
    --co-solid:  #1e4d3a;

    /* Domain — Immobilier (or ambré) */
    --re:        #9a7120;
    --re-lt:     #fdf6e3;
    --re-bd:     #e8d08a;
    --re-solid:  #b08a2a;

    /* Domain — Estimatiz (ardoise) */
    --est:       #4a5568;
    --est-lt:    #f0f1f4;
    --est-bd:    #c4cad8;
    --est-solid: #4a5568;

    /* Type accent colors */
    --t-company:       #1e4d3a;
    --t-establishment: #1e4d3a;
    --t-person:        #6d28d9;
    --t-address:       #9a7120;
    --t-parcel:        #2d6a4f;
    --t-copro:         #3a5a4a;
    --t-dpe:           #c2410c;

    /* Status */
    --s-actif:   #15803d;
    --s-ferme:   #b91c1c;

    /* Radii */
    --r-sm:  6px;
    --r-md:  10px;
    --r-lg:  16px;
    --r-xl:  20px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.2; }

/* ================================================
   NAVBAR
   ================================================ */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 54px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 clamp(14px, 3vw, 40px);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
    user-select: none;
}

.brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    display: grid;
    place-items: center;
    letter-spacing: 0;
    flex-shrink: 0;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: -.4px;
}

/* Nav search */
.nav-search {
    flex: 1;
    max-width: 620px;
    display: flex;
    gap: 0;
}

.search-wrap {
    flex: 1;
    position: relative;
    display: flex;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted);
    pointer-events: none;
    flex-shrink: 0;
}

#search-query {
    flex: 1;
    height: 36px;
    padding: 0 10px 0 32px;
    border: 1.5px solid var(--border-2);
    border-right: 1px solid var(--border);
    border-radius: var(--r-sm) 0 0 var(--r-sm);
    background: var(--surface-2);
    font-size: 13px;
    transition: border-color .15s, background .15s;
    outline: none;
}
#search-query:focus {
    border-color: var(--co);
    background: var(--surface);
    border-right-color: var(--border);
}

#search-type {
    height: 36px;
    padding: 0 24px 0 9px;
    border: 1.5px solid var(--border-2);
    border-left: none;
    border-right: none;
    border-radius: 0;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 12px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    min-width: 108px;
}
#search-type:focus { border-color: var(--co); }

.btn-search {
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    background: var(--co);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.btn-search:hover { background: var(--co-dk); }
.btn-search:focus-visible { outline: 3px solid rgba(30,77,58,.3); outline-offset: 2px; }

/* Nav end */
.nav-end {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.db-pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--s-actif);
    margin-right: 6px;
    flex-shrink: 0;
}
.db-pip.indisponible { background: var(--s-ferme); }

.nav-link {
    height: 32px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.nav-link:hover {
    background: var(--bg);
    color: var(--ink);
    border-color: var(--border);
}

/* ================================================
   ALERT BAR
   ================================================ */

.alert-bar {
    padding: 10px clamp(14px, 3vw, 40px);
    background: #fef2f2;
    border-bottom: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 13px;
}

/* ================================================
   LANDING PAGE
   ================================================ */

.landing {
    min-height: calc(100vh - 54px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px 72px;
}

.landing-inner {
    width: 100%;
    max-width: 860px;
    text-align: center;
}

.landing-title {
    font-size: clamp(72px, 14vw, 120px);
    font-weight: 800;
    color: var(--brand);
    letter-spacing: -5px;
    line-height: 1.0;
    margin-bottom: 22px;
}

.landing-sub {
    color: var(--muted);
    font-size: 17px;
    line-height: 1.7;
    margin-bottom: 40px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

/* Hero search */
.hero-search {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 40px;
}

.hero-wrap {
    display: flex;
    height: 64px;
    border: 2px solid var(--border-2);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: 0 2px 16px rgba(0,0,0,.09), 0 1px 3px rgba(0,0,0,.06);
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.hero-wrap:focus-within {
    border-color: var(--co);
    box-shadow: 0 0 0 4px rgba(30,77,58,.12), 0 2px 16px rgba(0,0,0,.09);
}

.hero-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    color: var(--muted);
    pointer-events: none;
    flex-shrink: 0;
}

.hero-wrap { position: relative; }

#hero-query {
    flex: 1;
    height: 100%;
    padding: 0 14px 0 56px;
    border: none;
    background: none;
    font-size: 17px;
    outline: none;
    color: var(--ink);
    min-width: 0;
}
#hero-query::placeholder { color: var(--muted); }

#hero-type {
    height: 100%;
    padding: 0 36px 0 18px;
    border: none;
    border-left: 1.5px solid var(--border);
    border-radius: 0;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    flex-shrink: 0;
    min-width: 130px;
}

.hero-btn {
    height: 100%;
    padding: 0 32px;
    border: none;
    border-left: 1.5px solid var(--co-dk);
    border-radius: 0 999px 999px 0;
    background: var(--co);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
    flex-shrink: 0;
    letter-spacing: -.2px;
}
.hero-btn:hover { background: var(--co-dk); }

/* Domain cards — solid colored, landscape */
.domain-cards {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.domain-card {
    flex: 1 1 220px;
    max-width: 280px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 28px 26px;
    border: none;
    border-radius: var(--r-lg);
    cursor: pointer;
    text-align: left;
    transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
    text-decoration: none;
}
.domain-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    filter: brightness(1.06);
}

.domain-card.co  { background: var(--co-solid); }
.domain-card.re  { background: var(--re-solid); }
.domain-card.est { background: var(--est-solid); }

.domain-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(255,255,255,.18);
    flex-shrink: 0;
}
.domain-icon svg {
    width: 28px;
    height: 28px;
    stroke: rgba(255,255,255,.95);
}

.domain-card-text {
    flex: 1;
    min-width: 0;
}

.domain-card strong {
    display: block;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.4px;
    color: #fff;
    margin-bottom: 4px;
}
.domain-card small {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,.72);
    line-height: 1.5;
}

/* Source chips */
.landing-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}
.src-chip {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 500;
}

/* ================================================
   WORKSPACE (après recherche)
   ================================================ */

.workspace {
    display: flex;
    height: calc(100vh - 56px);
}

.hidden { display: none !important; }

/* ---- Sidebar ---- */
.sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.sidebar-head {
    padding: 11px 13px 9px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface-2);
}

.result-meta {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 7px;
}

.type-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.type-pill {
    padding: 2px 9px;
    border-radius: 999px;
    border: 1.5px solid var(--border-2);
    background: var(--surface);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all .12s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.type-pill:hover:not(.active) { border-color: var(--ink-2); color: var(--ink-2); }
.type-pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.results-list {
    flex: 1;
    overflow-y: auto;
}

/* ---- Result cards ---- */
.result-card {
    width: 100%;
    padding: 11px 13px;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: none;
    text-align: left;
    cursor: pointer;
    display: grid;
    gap: 2px;
    transition: background .1s;
}
.result-card:hover { background: var(--surface-2); }
.result-card.active {
    background: var(--co-lt);
    border-left: 3px solid var(--co);
    padding-left: 10px;
}

.rc-type {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
}
.rc-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    overflow-wrap: anywhere;
    line-height: 1.35;
}
.rc-sub {
    font-size: 12px;
    color: var(--muted);
    overflow-wrap: anywhere;
    line-height: 1.35;
}

/* ---- Detail panel ---- */
.detail-panel {
    flex: 1;
    overflow-y: auto;
    padding: 28px clamp(20px, 3vw, 44px) 48px;
    background: var(--bg);
}

/* ================================================
   ENTITY DETAIL
   ================================================ */

.entity-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.entity-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entity-badges {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    align-items: center;
}

.entity-name {
    font-size: clamp(18px, 2.8vw, 26px);
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -.5px;
    line-height: 1.15;
}

.entity-id {
    font-size: 13px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: .1px;
}

.entity-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    padding-top: 2px;
}

/* KV grid */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 9px;
    margin-bottom: 22px;
}

.kv-card {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    overflow-wrap: anywhere;
}

.kv-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    margin-bottom: 4px;
}

.kv-value {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink);
}
.kv-value.is-null { color: var(--muted); font-weight: 400; font-style: italic; }

/* Entity section */
.entity-section {
    margin-top: 22px;
}

.section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -.2px;
}

/* ================================================
   DATA TABLE
   ================================================ */

.table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    padding: 8px 11px;
    background: var(--surface-2);
    border-bottom: 1.5px solid var(--border);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--ink-2);
    overflow-wrap: anywhere;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-2); }

/* ================================================
   BADGES
   ================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* Type badges */
.type-co  { background: var(--co-lt);  color: var(--co); }
.type-re  { background: var(--re-lt);  color: var(--re); }

.type-company       { background: #eef5f1; color: #1e4d3a; }
.type-person        { background: #f5f3ff; color: #6d28d9; }
.type-address       { background: #fdf6e3; color: #9a7120; }
.type-parcel        { background: #eef5f1; color: #2d6a4f; }
.type-copro         { background: #eef5f1; color: #3a5a4a; }
.type-dpe           { background: #fff7ed; color: #c2410c; }
.type-establishment { background: #eef5f1; color: #1e4d3a; }

/* Status badges */
.status-actif   { background: #dcfce7; color: #15803d; }
.status-ferme   { background: #fee2e2; color: #b91c1c; }
.status-unknown { background: var(--border); color: var(--muted); }

/* Count badge */
.count-badge {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--border);
    color: var(--ink-2);
    font-size: 11px;
    font-weight: 600;
}

/* DPE energy class */
.dpe-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
}
.dpe-A { background: #008033; }
.dpe-B { background: #4cae3b; }
.dpe-C { background: #cacd00; color: #333; }
.dpe-D { background: #f0a200; color: #333; }
.dpe-E { background: #e06d00; }
.dpe-F { background: #d63000; }
.dpe-G { background: #c20000; }

/* ================================================
   OVERLAYS / SHEETS
   ================================================ */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(26,26,46,.45);
    display: flex;
    align-items: flex-end;
    padding: 0;
    backdrop-filter: blur(3px);
}

@media (min-width: 600px) {
    .overlay {
        align-items: center;
        justify-content: center;
        padding: 24px;
    }
}

.sheet {
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

@media (min-width: 600px) {
    .sheet {
        border-radius: var(--r-lg);
    }
    .sheet-md { max-width: 820px; }
    .sheet-lg { max-width: 960px; }
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sheet-head h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.3px;
}

.sheet-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .12s, color .12s;
}
.sheet-close:hover { background: var(--border); color: var(--ink); }

.sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.sheet-body.p-0 { padding: 0; }

/* JSON pre */
.json-pre {
    margin: 0;
    padding: 20px;
    white-space: pre-wrap;
    font: 12.5px/1.6 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    color: #1e3a2a;
    background: #f8faf8;
    overflow: auto;
    min-height: 200px;
    max-height: calc(88vh - 65px);
}

/* ================================================
   BUTTONS
   ================================================ */

.btn-sm {
    height: 30px;
    padding: 0 11px;
    border: 1.5px solid var(--border-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, border-color .12s;
}
.btn-sm:hover { background: var(--bg); border-color: var(--muted); }

.btn-sm.primary {
    border-color: var(--co);
    background: var(--co);
    color: #fff;
}
.btn-sm.primary:hover { background: var(--co-dk); border-color: var(--co-dk); }

/* ================================================
   EMPTY / LOADING STATES
   ================================================ */

.empty-msg {
    padding: 20px 16px;
    color: var(--muted);
    font-size: 13px;
}

.empty-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 55vh;
    gap: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.empty-illus {
    width: 52px;
    height: 52px;
    color: var(--border-2);
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border);
    border-top-color: var(--co);
    border-radius: 50%;
    animation: spin .65s linear infinite;
    flex-shrink: 0;
}

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

/* ================================================
   SCHEMA TABLE
   ================================================ */

#schema-table table {
    width: 100%;
    border-collapse: collapse;
}
#schema-table th,
#schema-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 13px;
}
#schema-table th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}
#schema-table tr:last-child td { border-bottom: none; }

/* ================================================
   UTILITIES
   ================================================ */

.text-muted  { color: var(--muted); font-size: 13px; }
.mb-16 { margin-bottom: 16px; }

/* ================================================
   COMPANY DETAIL — Fiche scroll (cs-*)
   ================================================ */

/* Conteneur scroll */
.co-scroll { display: flex; flex-direction: column; gap: 12px; }

/* ---- Header ---- */
.cs-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px 22px 16px;
}

.cs-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.cs-name {
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -.6px;
    line-height: 1.1;
    margin: 0 0 4px;
}

.cs-siren {
    font-size: 13px;
    color: var(--muted);
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
}

.cs-actif  { color: var(--co);  font-weight: 600; }
.cs-cesse  { color: var(--re);  font-weight: 600; }

.cs-actions { display: flex; gap: 6px; flex-shrink: 0; padding-top: 3px; }

.cs-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    text-decoration: none;
    transition: border-color .12s, color .12s;
    white-space: nowrap;
}
.cs-btn:hover { border-color: var(--co); color: var(--co); }

/* Table résumé dans le header */
.cs-summary {
    width: 100%;
    border-collapse: collapse;
    border-top: 1px solid var(--border);
}
.cs-summary tr { border-bottom: 1px solid var(--border); }
.cs-summary tr:last-child { border-bottom: none; }
.cs-summary td { padding: 8px 0; vertical-align: top; }

/* ---- Sections ---- */
.cs-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 22px;
    overflow: hidden;
}

.cs-section-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -.1px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -18px -22px 18px;
    padding: 11px 22px;
    background: var(--co-lt);
    border-bottom: 1px solid var(--co-bd);
}

.cs-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--co);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.cs-empty { font-size: 13px; color: var(--muted); margin: 0; }

/* ---- Table infos (label / valeur) ---- */
.cs-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    white-space: nowrap;
    padding-right: 16px;
    vertical-align: top;
    width: 35%;
}

.cs-value {
    font-size: 13.5px;
    color: var(--ink);
    vertical-align: top;
    line-height: 1.5;
}

.cs-val-right { text-align: right; font-weight: 500; overflow-wrap: anywhere; }

.cs-table {
    width: 100%;
    border-collapse: collapse;
}
.cs-table tr { border-bottom: 1px solid var(--border); }
.cs-table tr:last-child { border-bottom: none; }
.cs-table tr:hover td { background: var(--surface-2); }
.cs-table td { padding: 9px 4px; }

/* ---- Dirigeants — lignes ---- */
.cs-person-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.cs-person-row:last-child { border-bottom: none; }

.cs-person-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--co);
    margin-bottom: 2px;
}

.cs-person-role { font-size: 12px; color: var(--muted); line-height: 1.4; }

.cs-person-right {
    font-size: 12px;
    color: var(--muted);
    text-align: right;
    flex-shrink: 0;
    line-height: 1.5;
}

/* ---- BODACC timeline ---- */
.cs-bodacc-item { display: flex; gap: 0; }

.cs-bodacc-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 26px;
    flex-shrink: 0;
}

.cs-bodacc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--co);
    flex-shrink: 0;
    margin-top: 4px;
}

.cs-bodacc-vline {
    width: 2px;
    flex: 1;
    min-height: 16px;
    background: var(--co-bd);
    margin-top: 4px;
}

.cs-bodacc-body { flex: 1; min-width: 0; padding-bottom: 16px; }

.cs-bodacc-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.cs-bodacc-date { font-size: 12px; color: var(--muted); font-weight: 600; }

.cs-bodacc-badge {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .4px;
    background: #fff3cd;
    color: #92640a;
    border: 1px solid #f5d67a;
}

.cs-bodacc-greffe { font-size: 11.5px; color: var(--muted); }

.cs-bodacc-text {
    font-size: 13px;
    color: var(--ink-2);
    line-height: 1.65;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 11px 14px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* ---- Finances ---- */
.cs-finance-block { margin-bottom: 16px; }
.cs-finance-block:last-child { margin-bottom: 0; }

.cs-finance-year {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    margin-bottom: 6px;
}

/* ---- Documents ---- */
.cs-doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.cs-doc-row:last-child { border-bottom: none; }
.cs-doc-name { font-size: 13.5px; color: var(--ink); font-weight: 500; }
.cs-doc-date { font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* Anciens dirigeants */
.cs-ancien-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    padding: 10px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}
.cs-person-ancien .cs-person-name { color: var(--muted); }
.cs-muted { color: var(--muted); }

/* ---- KPI grid (P1) ---- */
.cs-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.cs-kpi-card {
    background: var(--co-lt);
    border: 1px solid var(--co-bd);
    border-radius: var(--r-md);
    padding: 10px 13px;
}

.cs-kpi-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--co);
    margin-bottom: 5px;
    opacity: .85;
}

.cs-kpi-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* ---- Header pills (P4) ---- */
.cs-header-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 0;
}

.cs-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--ink-2);
    white-space: nowrap;
}

.cs-pill-actif {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}

.cs-pill-cesse {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.cs-pill-naf {
    background: var(--co-lt);
    border-color: var(--co-bd);
    color: var(--co);
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 10.5px;
}

/* ---- Avatar initiales (P3) ---- */
.cs-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--co);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    user-select: none;
    letter-spacing: 0;
}

.cs-person-ancien .cs-avatar {
    background: var(--border-2);
    color: var(--muted);
}

/* Header accent top */
.cs-header {
    border-top: 3px solid var(--co);
}

/* Iframe panneau détail */
.detail-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}
.detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 54px);
    color: var(--muted);
    gap: 16px;
    padding: 40px;
    text-align: center;
}

/* Bouton fiche complète dans le panneau inline */
.btn-fiche {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--co);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s;
}
.btn-fiche:hover { background: var(--co-dk); color: #fff; }

/* ================================================
   PAGE LAYOUT 2 COLONNES (liste sticky | détail scroll)
   ================================================ */

.page-layout {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - 54px);
}

/* Panneau gauche : filtres + résultats */
.left-panel {
    width: 340px;
    flex-shrink: 0;
    position: sticky;
    top: 54px;
    height: calc(100vh - 54px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--surface);
}

/* Filtres avancés dans le panneau gauche */
.adv-filters {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    background: var(--surface-2);
}

/* Formulaire de recherche inline dans la navbar (entreprises) */
.nav-co-form {
    flex: 1;
    display: flex;
    align-items: center;
    max-width: 760px;
    gap: 0;
}

/* Champ de recherche principal dans la navbar */
.nav-q {
    flex: 1;
    height: 36px;
    padding: 0 10px 0 32px;
    border: 1.5px solid var(--border-2);
    border-right: none;
    border-radius: var(--r-sm) 0 0 var(--r-sm);
    background: var(--surface-2);
    font-size: 13px;
    transition: border-color .15s, background .15s;
    outline: none;
    min-width: 0;
}
.nav-q:focus { border-color: var(--co); background: var(--surface); }

/* Champ département / CP dans la navbar */
.nav-dept {
    width: 96px;
    height: 36px;
    padding: 0 8px;
    border: 1.5px solid var(--border-2);
    border-left: none;
    border-right: none;
    border-radius: 0;
    background: var(--surface-2);
    font-size: 12.5px;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, background .15s;
    flex-shrink: 0;
}
.nav-dept::placeholder { color: var(--muted); }
.nav-dept:focus { border-color: var(--co); background: var(--surface); }

/* Select état dans la navbar */
.nav-etat {
    width: 84px;
    height: 36px;
    padding: 0 20px 0 8px;
    border: 1.5px solid var(--border-2);
    border-left: none;
    border-right: none;
    border-radius: 0;
    background: var(--surface-2);
    font-size: 12.5px;
    color: var(--ink);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s;
}
.nav-etat:focus { border-color: var(--co); }

/* Héritage conservé pour rétrocompat */
.filter-sidebar { display: none; }
.filter-body {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-section { display: flex; flex-direction: column; gap: 6px; }

.filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
}

.filter-input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1.5px solid var(--border-2);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: 13px;
    outline: none;
    transition: border-color .15s, background .15s;
    color: var(--ink);
}
.filter-input:focus { border-color: var(--co); background: var(--surface); }
.filter-input.re-focus:focus { border-color: var(--re-solid); }

.filter-select {
    width: 100%;
    height: 36px;
    padding: 0 28px 0 10px;
    border: 1.5px solid var(--border-2);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--ink);
    font-size: 13px;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    cursor: pointer;
    transition: border-color .15s;
}
.filter-select:focus { outline: none; border-color: var(--co); }
.filter-select.re-focus:focus { border-color: var(--re-solid); }

.radio-group { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    cursor: pointer;
    color: var(--ink-2);
}
.radio-item input[type="radio"] { accent-color: var(--co); cursor: pointer; }
.radio-item.re input[type="radio"] { accent-color: var(--re-solid); }

.filter-range {
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-range .filter-input { flex: 1; }
.filter-range-sep { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.filter-range-unit {
    font-size: 11px;
    color: var(--muted);
    flex-shrink: 0;
    margin-left: -2px;
}

.filter-search-wrap {
    position: relative;
}
.filter-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--muted);
    pointer-events: none;
}
.filter-search-wrap .filter-input { padding-left: 32px; }

.filter-btn {
    width: 100%;
    height: 42px;
    border: none;
    border-radius: var(--r-md);
    background: var(--co);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    margin-top: 4px;
}
.filter-btn:hover { background: var(--co-dk); }
.filter-btn.re-btn { background: var(--re-solid); }
.filter-btn.re-btn:hover { filter: brightness(.9); }

.filter-reset {
    width: 100%;
    height: 32px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    background: none;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    transition: color .12s, border-color .12s;
}
.filter-reset:hover { color: var(--ink); border-color: var(--muted); }

/* Colonne résultats */
.result-col {
    width: 360px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Sans panneau de détail : résultats pleine largeur en grille */
.result-col.result-col-full {
    width: auto;
    flex: 1;
    border-right: none;
}

.result-col.result-col-full .result-col-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    align-content: start;
    gap: 0;
    padding: 8px;
}

.result-col-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-col-list {
    flex: 1;
    overflow-y: auto;
}

/* Result cards larges */
.rc-lg {
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background .1s;
    display: block;
}
.rc-lg:hover { background: var(--surface-2); }
.rc-lg.active {
    background: var(--co-lt);
    border-left: 3px solid var(--co);
    padding-left: 13px;
}
.rc-lg.active-re {
    background: var(--re-lt);
    border-left: 3px solid var(--re-solid);
    padding-left: 13px;
}

.rc-lg-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    gap: 8px;
}
.rc-lg-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
    margin-bottom: 2px;
    overflow-wrap: anywhere;
}
.rc-lg-sub {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}
.rc-lg-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--re);
    margin: 3px 0 2px;
}
.rc-lg-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--muted);
}

/* Colonne détail — hauteur naturelle, page scroll */
.detail-col {
    flex: 1;
    min-width: 0;
    min-height: calc(100vh - 54px);
    padding: 28px clamp(20px, 3vw, 44px) 48px;
    background: var(--bg);
}

/* Breadcrumb navbar */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
}
.breadcrumb-home {
    font-weight: 700;
    color: var(--brand);
    display: flex;
    align-items: center;
    gap: 7px;
}
.breadcrumb-sep { color: var(--border-2); font-size: 16px; }
.breadcrumb-current {
    font-size: 14px;
    font-weight: 700;
}
.breadcrumb-current.co { color: var(--co); }
.breadcrumb-current.re { color: var(--re); }

/* Onglets source (Immobilier) */
.source-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin: 0 -16px;
    padding: 0 8px;
    flex-shrink: 0;
}
.source-tab {
    padding: 10px 12px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    transition: color .12s, border-color .12s;
}
.source-tab:hover { color: var(--ink); }
.source-tab.active { color: var(--re); border-bottom-color: var(--re-solid); }

.tab-panel { display: none; flex-direction: column; gap: 16px; padding-top: 16px; }
.tab-panel.active { display: flex; }

/* Pied de panneau gauche */
.panel-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface-2);
}

/* Pagination load-more */
.load-more-wrap {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.load-more-btn {
    width: 100%;
    height: 34px;
    border: 1.5px solid var(--border-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.load-more-btn:hover { background: var(--bg); border-color: var(--muted); }
.load-more-btn:disabled { opacity: .5; cursor: default; }

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 820px) {
    .brand-name { display: none; }

    .workspace {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 56px);
    }

    .sidebar {
        width: 100%;
        max-height: 42vh;
    }

    .detail-panel {
        min-height: 58vh;
        padding: 18px;
    }

    .domain-card {
        max-width: 100%;
        flex: 1 1 280px;
    }
}

@media (max-width: 560px) {
    #search-type { display: none; }
    #search-query { border-radius: var(--r-sm) 0 0 var(--r-sm); }
    .nav-end .nav-link:nth-child(3) { display: none; }

    .domain-cards { gap: 10px; }
    .domain-card { padding: 22px 20px; }
    .domain-card strong { font-size: 16px; }
}
