/* ============================================================
   DÉCOUPE LASER FACILE — Design System
   Dark industrial theme · Gold accent #BE8D51
   ============================================================ */

/* === TOKENS === */
:root {
    --gold:        #BE8D51;
    --gold-hover:  #d4a060;
    --gold-dim:    rgba(190,141,81,.12);
    --bg:          #0d0d0d;
    --surface:     #161618;
    --surface-2:   #1e1e21;
    --surface-3:   #262629;
    --border:      #2a2a2e;
    --border-light:#363639;
    --text:        #e4e4e7;
    --text-muted:  #71717a;
    --text-faint:  #3f3f46;
    --error:       #f87171;
    --error-bg:    rgba(248,113,113,.1);
    --success:     #4ade80;
    --success-bg:  rgba(74,222,128,.1);

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Courier New', monospace;

    --r:   6px;
    --r-lg:12px;
    --r-xl:18px;
    --shadow: 0 4px 24px rgba(0,0,0,.55);
    --t: 150ms ease;
    --header-h: 64px;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

a { color: var(--gold); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--gold-hover); }

img { display: block; max-width: 100%; }
button, input, select, textarea { font-family: var(--font); }

/* === HEADER === */
.site-header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: 1.0625rem;
    color: var(--gold);
    white-space: nowrap;
    letter-spacing: -.02em;
}
.logo:hover { color: var(--gold-hover); }
.logo-icon { font-size: 1.25rem; line-height: 1; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.site-nav a {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: .25rem 0;
    border-bottom: 2px solid transparent;
    transition: color var(--t), border-color var(--t);
}
.site-nav a:hover,
.site-nav a.active { color: var(--text); border-bottom-color: var(--gold); }
.site-nav .nav-cta { color: var(--gold); }
.site-nav .nav-cta:hover { color: var(--gold-hover); }

.nav-user {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .8125rem;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .25rem .75rem;
}
.nav-user-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}
.nav-logout {
    font-size: .8125rem !important;
    color: var(--text-faint) !important;
}
.nav-logout:hover { color: var(--error) !important; border-bottom-color: transparent !important; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .25rem;
}
.nav-toggle span {
    display: block;
    width: 22px; height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: var(--t);
}

/* === LAYOUT === */
.site-main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem 5rem;
}

.container-sm { max-width: 480px; margin: 0 auto; }
.container-md { max-width: 720px; margin: 0 auto; }

/* === FOOTER === */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 2rem;
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--gold);
    font-weight: 600;
    font-size: .875rem;
}
.footer-nav { display: flex; gap: 1.25rem; }
.footer-nav a { font-size: .8125rem; color: var(--text-muted); }
.footer-nav a:hover { color: var(--text); }
.footer-copy { margin-left: auto; font-size: .75rem; color: var(--text-faint); }

/* === PAGE TITLE === */
.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -.03em;
    margin-bottom: 2rem;
    color: var(--text);
}
.page-title span { color: var(--gold); }

/* === CARDS === */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.5rem; }
.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.card-title::before {
    content: '';
    display: block;
    width: 3px;
    height: 1em;
    background: var(--gold);
    border-radius: 2px;
    flex-shrink: 0;
}

/* === FORMS === */
.form-group { margin-bottom: 1.125rem; }
.form-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .375rem;
}
.form-input {
    width: 100%;
    padding: .625rem .875rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    font-size: .9375rem;
    transition: border-color var(--t), background var(--t);
    appearance: none;
    -webkit-appearance: none;
}
.form-input:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--surface-3);
}
.form-input::placeholder { color: var(--text-faint); }
textarea.form-input { resize: vertical; min-height: 100px; }
select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2371717a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .875rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .625rem 1.375rem;
    border-radius: var(--r);
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--t), color var(--t), border-color var(--t), transform var(--t);
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: scale(.98); }

.btn-primary { background: var(--gold); color: #0d0d0d; border-color: var(--gold); }
.btn-primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); color: #0d0d0d; }

.btn-outline {
    background: transparent;
    border-color: var(--border-light);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }

.btn-sm { padding: .375rem .875rem; font-size: .8125rem; }
.btn-lg { padding: .875rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; }

.btn-danger { background: transparent; border-color: var(--error); color: var(--error); }
.btn-danger:hover { background: var(--error-bg); }

/* === ALERTS === */
.alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .875rem 1rem;
    border-radius: var(--r);
    font-size: .875rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.alert-error  { background: var(--error-bg);   border: 1px solid rgba(248,113,113,.3);  color: var(--error); }
.alert-success{ background: var(--success-bg);  border: 1px solid rgba(74,222,128,.3);   color: var(--success); }
.alert-info   { background: var(--gold-dim);    border: 1px solid rgba(190,141,81,.3);   color: var(--gold); }

/* === DIVIDERS === */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-faint);
    font-size: .8125rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* === PRICE LINES === */
.price-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
    gap: 1rem;
}
.price-line:last-of-type { border-bottom: none; }
.price-line .label { color: var(--text-muted); }
.price-line .value { font-variant-numeric: tabular-nums; font-weight: 500; }

.price-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 1rem 0 0;
    margin-top: .5rem;
    border-top: 2px solid var(--gold);
}
.price-total .label { font-size: 1rem; font-weight: 600; }
.price-total .value { font-size: 1.75rem; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }

/* === DXF DROPZONE === */
.dxf-dropzone {
    border: 2px dashed var(--border-light);
    border-radius: var(--r-xl);
    padding: 3.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--t), background var(--t);
    user-select: none;
}
.dxf-dropzone:hover,
.dxf-dropzone.drag-over {
    border-color: var(--gold);
    background: var(--gold-dim);
}
.dxf-dropzone.has-file {
    border-style: solid;
    border-color: var(--gold);
    background: var(--gold-dim);
    padding: 1.5rem 2rem;
}
.dxf-drop-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: .75rem;
    opacity: .6;
}
.dxf-drop-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .375rem;
}
.dxf-drop-sub {
    font-size: .875rem;
    color: var(--text-muted);
}
.dxf-drop-sub strong { color: var(--gold); }
.dxf-file-name {
    font-family: var(--mono);
    font-size: .9rem;
    color: var(--gold);
    margin-top: .5rem;
}

/* === SVG VIEWER === */
.viewer-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.svg-viewer {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image:
        linear-gradient(rgba(190,141,81,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(190,141,81,.04) 1px, transparent 1px);
    background-size: 30px 30px;
    position: relative;
}
.svg-viewer-wrap { position: relative; overflow: hidden; border-radius: var(--r-lg); }
.svg-viewer svg {
    max-width: 90%; max-height: 90%;
    will-change: transform;
    transition: none;
}

/* ── Modale éditeur ─────────────────────────────────────────────────────── */
.emodal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: stretch; justify-content: center;
}
.emodal[hidden] { display: none; }
.emodal-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.75); backdrop-filter: blur(4px);
}
.emodal-panel {
    position: relative; z-index: 1;
    display: flex; flex-direction: column;
    width: 100%; max-width: 1280px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.emodal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.emodal-title { font-weight: 600; font-size: 1rem; }
.emodal-close {
    width: 2rem; height: 2rem;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--r-sm); color: var(--text-muted);
    cursor: pointer; font-size: .9rem;
}
.emodal-close:hover { color: var(--text); border-color: var(--text-muted); }
.emodal-body {
    flex: 1; overflow: hidden;
    background: var(--surface-2);
    background-image:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 30px 30px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.emodal-body svg {
    max-width: 100%; max-height: 100%;
    will-change: transform;
}
.emodal-footer {
    display: flex; gap: .75rem; justify-content: flex-end;
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.emodal-panel .editor-toolbar {
    border-radius: 0;
    border-left: none; border-right: none; border-top: none;
    flex-shrink: 0;
}
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }

/* ── Toolbar éditeur ────────────────────────────────────────────────────── */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .625rem .75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: .75rem;
}
.editor-tool-group { display: flex; gap: .35rem; }
.editor-tool-btn {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .3rem .65rem;
    font-size: .8rem; font-weight: 500;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-sm); color: var(--text-muted);
    cursor: pointer; white-space: nowrap;
    transition: color .15s, border-color .15s, background .15s;
}
.editor-tool-btn:hover { color: var(--text); border-color: var(--text-muted); }
.editor-tool-btn.active {
    color: var(--gold); border-color: var(--gold);
    background: rgba(190,141,81,.1);
}
.editor-actions { margin-left: auto; }
.editor-action-btn {
    padding: .3rem .65rem; font-size: .8rem;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--r-sm); color: var(--text-muted);
    cursor: pointer;
}
.editor-action-btn:hover { color: var(--text); border-color: var(--text-muted); }
.editor-zoom { gap: .25rem; align-items: center; }
.editor-zoom-btn {
    width: 1.75rem; height: 1.75rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-sm); color: var(--text); cursor: pointer;
    font-size: .9rem; line-height: 1;
}
.editor-zoom-btn:hover { border-color: var(--gold); color: var(--gold); }
.editor-zoom-fit { font-size: .8rem; width: auto; padding: 0 .4rem; }
.editor-zoom-label {
    min-width: 3rem; text-align: center;
    font-size: .8rem; font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}
.editor-options {
    display: flex; gap: .75rem; align-items: center;
    padding: .2rem .5rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-sm);
}
.editor-opt-label {
    font-size: .8rem; color: var(--text-muted);
    display: flex; align-items: center; gap: .4rem;
}
/* Input texte inline dans le SVG */
.editor-text-input {
    position: absolute;
    background: var(--surface); border: 1px solid var(--gold);
    border-radius: var(--r-sm); color: var(--text);
    padding: .25rem .5rem; font-size: .875rem;
    outline: none; z-index: 10; min-width: 150px;
}
.form-input-sm { padding: .2rem .4rem !important; font-size: .8rem !important; }
.svg-viewer-placeholder {
    color: var(--text-faint);
    font-size: .875rem;
    text-align: center;
}

.stats-panel {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.25rem;
}
.stat-item {
    display: flex;
    flex-direction: column;
    padding: .625rem 0;
    border-bottom: 1px solid var(--border);
}
.stat-item:last-child { border-bottom: none; }
.stat-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin-bottom: .2rem; }
.stat-value { font-size: .9375rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-value.gold { color: var(--gold); }

/* === DEVIS LAYOUT (step 3) === */
.devis-calc-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1.5rem;
}
.params-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    max-height: calc(100vh - var(--header-h) - 3rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.params-panel::-webkit-scrollbar { width: 4px; }
.params-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.params-section {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.params-section:last-child { border-bottom: none; }
.params-section-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    font-weight: 600;
    margin-bottom: 1rem;
}
.param-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
    gap: .5rem;
}
.param-row:last-child { margin-bottom: 0; }
.param-label { font-size: .8125rem; color: var(--text-muted); flex: 1; }
.param-input {
    width: 90px;
    text-align: right;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    padding: .3rem .5rem;
    font-family: var(--mono);
    font-size: .8125rem;
    transition: border-color var(--t);
}
.param-input:focus { border-color: var(--gold); outline: none; }
.param-select {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text);
    padding: .3rem .5rem;
    font-size: .8125rem;
    cursor: pointer;
    transition: border-color var(--t);
    flex: 1;
    min-width: 0;
}
.param-select:focus { border-color: var(--gold); outline: none; }

.live-panel { display: flex; flex-direction: column; gap: 1rem; }
.live-placeholder {
    background: var(--surface);
    border: 1px dashed var(--border-light);
    border-radius: var(--r-xl);
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-faint);
}
.live-placeholder-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }
.live-placeholder p { font-size: .9rem; }

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .75rem;
}
.info-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: .875rem 1rem;
}
.info-card-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin-bottom: .25rem; }
.info-card-value { font-size: 1rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.cost-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
}
.cost-block-section {
    padding: .75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.cost-block-section:last-child { border-bottom: none; }
.cost-category {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-faint);
    font-weight: 600;
    margin-bottom: .5rem;
}

.totals-block {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: var(--r-xl);
    padding: 1.25rem 1.5rem;
}
.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .9375rem;
    padding: .35rem 0;
    font-variant-numeric: tabular-nums;
}
.total-row.ht { color: var(--text-muted); }
.total-row.ttc { font-size: 1.5rem; font-weight: 700; color: var(--gold); margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border); }

/* === AUTH PAGES === */
.auth-wrap {
    max-width: 420px;
    margin: 4rem auto 0;
}
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: .375rem; }
.auth-header p { color: var(--text-muted); font-size: .9375rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .875rem; color: var(--text-muted); }
.auth-footer a { color: var(--gold); font-weight: 500; }

/* === HOME PAGE === */
.hero {
    text-align: center;
    padding: 5rem 1rem;
    max-width: 700px;
    margin: 0 auto;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--gold-dim);
    border: 1px solid rgba(190,141,81,.3);
    color: var(--gold);
    font-size: .8125rem;
    font-weight: 600;
    padding: .3rem .875rem;
    border-radius: 999px;
    margin-bottom: 1.75rem;
    letter-spacing: .02em;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.04em;
    margin-bottom: 1.25rem;
}
.hero h1 span { color: var(--gold); }
.hero p {
    font-size: 1.125rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 2.5rem;
}
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-top: 4rem;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 1.5rem;
    transition: border-color var(--t);
}
.feature-card:hover { border-color: var(--gold); }
.feature-icon { font-size: 1.75rem; margin-bottom: .875rem; }
.feature-title { font-size: 1rem; font-weight: 600; margin-bottom: .375rem; }
.feature-desc { font-size: .875rem; color: var(--text-muted); line-height: 1.6; }

/* === STEPS === */
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--gold);
    color: #0d0d0d;
    font-size: .8125rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: .75rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .site-header { padding: 0 1rem; }
    .site-main { padding: 2rem 1rem 4rem; }

    .site-nav {
        display: none;
        position: absolute;
        top: var(--header-h);
        left: 0; right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: .75rem;
    }
    .site-nav.open { display: flex; }
    .nav-toggle { display: flex; }

    .viewer-grid { grid-template-columns: 1fr; }
    .stats-panel { flex-direction: row; flex-wrap: wrap; gap: .5rem; }
    .stat-item { flex: 1 1 120px; }

    .devis-calc-grid { grid-template-columns: 1fr; }
    .params-panel { position: static; max-height: none; }
}

/* ============================================================
   UPLOAD TABS
   ============================================================ */
.upload-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.upload-tab {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .625rem 1.125rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: .9375rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: -1px;
    transition: color var(--t), border-color var(--t);
}
.upload-tab:hover { color: var(--text); }
.upload-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}
.upload-tab-content { display: none; }
.upload-tab-content.active { display: block; }

/* ============================================================
   PHOTO PROCESSING UI
   ============================================================ */
.photo-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.25rem 0;
}
.photo-preview-panel {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.photo-preview-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.photo-canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--r);
    border: 1px solid var(--border);
    background: var(--surface-2);
}
.photo-processing-badge {
    font-size: .7rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: var(--gold-dim);
    color: var(--gold);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.photo-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.25rem;
    margin-top: .5rem;
}
.photo-control-row {
    display: flex;
    flex-direction: column;
    gap: .375rem;
}
.photo-control-label {
    font-size: .8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Range slider — threshold */
.photo-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.photo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--gold);
}
.photo-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    border: 2px solid var(--surface);
}
.photo-threshold-val {
    font-family: var(--mono);
    font-size: .8125rem;
    color: var(--gold);
    margin-left: .25rem;
}

.photo-vectorize-status {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .photo-preview-grid { grid-template-columns: 1fr; }
}

/* ── Live result loading state ── */
.live-loading {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 2rem;
    color: var(--text-muted);
    font-size: .9375rem;
}
.live-loading-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--gold);
    animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.75); }
}

/* ════════════════════════════════════════════════════════════════════════════
   PANIER & COMPTE
   ════════════════════════════════════════════════════════════════════════════ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}
.page-header .page-title { margin-bottom: 0; }

/* Badge nav */
.nav-panier {
    position: relative;
    font-size: 1.2rem;
    line-height: 1;
    padding: .25rem .35rem;
    border-radius: var(--r-sm);
    text-decoration: none;
    transition: background .15s;
}
.nav-panier:hover { background: var(--surface-2); }
.panier-badge {
    position: absolute;
    top: -5px; right: -6px;
    background: var(--gold);
    color: var(--bg);
    font-size: .6rem;
    font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}
.count-badge {
    display: inline-block;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: .1rem .6rem;
    border-radius: 999px;
    margin-left: .75rem;
    vertical-align: middle;
}

/* Panier vide */
.panier-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.panier-empty-icon { font-size: 3rem; margin-bottom: 1rem; }

/* Liste articles */
#panier-items { display: flex; flex-direction: column; gap: .75rem; }

.panier-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.25rem;
    transition: border-color .15s;
}
.panier-item:hover { border-color: var(--gold-dim); }
.panier-item-icon { font-size: 1.75rem; flex-shrink: 0; margin-top: .1rem; }
.panier-item-body { flex: 1; min-width: 0; }
.panier-item-name {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: .35rem;
}
.panier-item-meta {
    font-size: .8125rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .5rem;
}
.panier-item-meta .sep { color: var(--border); }
.panier-item-notes {
    font-size: .8125rem;
    color: var(--text-faint);
    font-style: italic;
    margin-bottom: .5rem;
}
.panier-item-files { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-file {
    font-size: .75rem;
    padding: .2rem .6rem;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    color: var(--gold);
    text-decoration: none;
    font-family: var(--mono);
    transition: border-color .15s, background .15s;
}
.btn-file:hover { border-color: var(--gold); background: var(--gold-dim); }
.panier-item-price {
    flex-shrink: 0;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .35rem;
}
.item-ht { font-size: .9375rem; font-weight: 600; color: var(--text); font-family: var(--mono); }
.item-ttc { font-size: .8125rem; color: var(--text-muted); font-family: var(--mono); }
.btn-remove {
    font-size: .75rem;
    padding: .2rem .6rem;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color .15s, color .15s;
    margin-top: .25rem;
}
.btn-remove:hover { border-color: var(--error); color: var(--error); }

/* Récapitulatif */
.panier-summary {
    margin-top: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    max-width: 480px;
    margin-left: auto;
}
.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .9375rem;
    color: var(--text-muted);
}
.summary-line:last-of-type { border-bottom: none; }
.summary-line.total {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    padding-top: .75rem;
}
.summary-line span:last-child { font-family: var(--mono); }

/* Onglets compte */
.compte-tabs {
    display: flex;
    gap: .5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.compte-tab {
    background: none;
    border: none;
    padding: .75rem 1.25rem;
    font-size: .9375rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.compte-tab:hover { color: var(--text); }
.compte-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-count {
    font-size: .7rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .05rem .45rem;
    font-family: var(--mono);
}
.compte-panel { display: none; }
.compte-panel.active { display: block; }
.compte-empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

/* Cartes devis/factures */
.devis-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.25rem;
    margin-bottom: .75rem;
}
.devis-card-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}
.devis-ref { font-family: var(--mono); font-weight: 600; color: var(--gold); font-size: .9375rem; }
.devis-date { font-size: .8125rem; color: var(--text-faint); margin-left: auto; }
.status-badge {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .2rem .6rem;
    border-radius: 999px;
}
.status-en_attente  { background: rgba(250,204,21,.12);  color: #facc15; }
.status-en_cours    { background: rgba(96,165,250,.12);  color: #60a5fa; }
.status-termine     { background: rgba(74,222,128,.12);  color: #4ade80; }
.status-annule      { background: rgba(248,113,113,.12); color: #f87171; }
.status-impayee     { background: rgba(250,204,21,.12);  color: #facc15; }
.status-payee       { background: rgba(74,222,128,.12);  color: #4ade80; }
.devis-card-items { margin-bottom: .75rem; }
.devis-item-row {
    display: grid;
    grid-template-columns: 1.5rem 1fr auto auto;
    gap: .5rem;
    align-items: center;
    padding: .4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .8125rem;
}
.devis-item-row:last-child { border-bottom: none; }
.devis-item-name { color: var(--text); font-weight: 500; }
.devis-item-detail { color: var(--text-muted); }
.devis-item-price { font-family: var(--mono); color: var(--text); white-space: nowrap; }
.devis-card-foot {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: .875rem;
    color: var(--text-muted);
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}
.devis-card-foot strong { color: var(--text); }
.devis-notes {
    margin-top: .75rem;
    font-size: .8125rem;
    color: var(--text-faint);
    font-style: italic;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}

/* Chat */
.chat-thread {
    min-height: 200px;
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    margin-bottom: 1rem;
    scroll-behavior: smooth;
}
.chat-empty { color: var(--text-faint); font-size: .875rem; text-align: center; padding: 2rem 0; }
.chat-msg { display: flex; flex-direction: column; max-width: 75%; }
.chat-client { align-self: flex-end; align-items: flex-end; }
.chat-admin  { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
    padding: .65rem 1rem;
    border-radius: 1rem;
    font-size: .9375rem;
    line-height: 1.5;
    word-break: break-word;
}
.chat-client .chat-bubble { background: var(--gold); color: var(--bg); border-bottom-right-radius: .25rem; }
.chat-admin  .chat-bubble { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: .25rem; }
.chat-meta { font-size: .7rem; color: var(--text-faint); margin-top: .25rem; padding: 0 .25rem; }

@media (max-width: 600px) {
    .panier-item { flex-direction: column; }
    .panier-item-price { align-items: flex-start; flex-direction: row; gap: 1rem; flex-wrap: wrap; }
    .devis-item-row { grid-template-columns: 1.5rem 1fr; }
    .devis-item-detail, .devis-item-price { grid-column: 2; }
}

/* ── Administration ──────────────────────────────────────────────────────────── */
.admin-page { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.admin-header h1 { margin: 0; font-size: 1.75rem; }

.admin-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: .75rem; }
.admin-tab { background: none; border: 1px solid var(--border); color: var(--text-faint); border-radius: var(--r); padding: .45rem .9rem; font-size: .875rem; cursor: pointer; display: flex; align-items: center; gap: .4rem; transition: .15s; }
.admin-tab:hover { border-color: var(--gold); color: var(--text); }
.admin-tab.active { background: var(--gold); color: var(--bg); border-color: var(--gold); font-weight: 600; }
.tab-count { background: rgba(0,0,0,.3); border-radius: 99px; padding: .1em .45em; font-size: .75rem; font-weight: 700; }
.admin-tab.active .tab-count { background: rgba(0,0,0,.25); }

.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-empty { color: var(--text-faint); text-align: center; padding: 3rem 0; }

/* Cartes devis */
.devis-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 1.25rem; overflow: hidden; }
.devis-card-top { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: .4rem; }
.devis-card-ref { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.devis-card-ref strong { font-family: var(--font-mono); font-size: .95rem; color: var(--text); }
.devis-card-meta { font-size: .8rem; color: var(--text-faint); display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.meta-sep { opacity: .4; }

/* Tableau des lignes */
.devis-items-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.devis-items-table th { padding: .5rem 1.25rem; text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.devis-items-table td { padding: .6rem 1.25rem; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.devis-items-table tr:last-child td { border-bottom: none; }
.text-right { text-align: right; }

.devis-card-footer { padding: .85rem 1.25rem; display: flex; flex-direction: column; gap: .6rem; }
.devis-total-line { font-size: .9rem; color: var(--text-muted); }
.devis-total-line strong { color: var(--gold); font-size: 1rem; }
.devis-notes { font-size: .85rem; color: var(--text-muted); font-style: italic; }
.devis-rejection { font-size: .85rem; color: #e57373; }
.devis-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Badges */
.admin-badge { display: inline-flex; align-items: center; padding: .2em .65em; border-radius: 99px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.admin-badge-secondary { font-size: .75rem; color: var(--text-faint); font-family: var(--font-mono); }
.badge-pending  { background: rgba(190,141,81,.2);  color: var(--gold); }
.badge-accepted { background: rgba(74,222,128,.15); color: #4ade80; }
.badge-rejected { background: rgba(248,113,113,.15);color: #f87171; }
.badge-invoiced { background: rgba(96,165,250,.15); color: #60a5fa; }
.badge-unpaid   { background: rgba(251,191,36,.15); color: #fbbf24; }
.badge-paid     { background: rgba(74,222,128,.15); color: #4ade80; }

/* Boutons d'action admin */
.btn-accept  { background: rgba(74,222,128,.15);  color: #4ade80; border: 1px solid rgba(74,222,128,.3); }
.btn-accept:hover  { background: rgba(74,222,128,.3); }
.btn-reject  { background: rgba(248,113,113,.12); color: #f87171; border: 1px solid rgba(248,113,113,.3); }
.btn-reject:hover  { background: rgba(248,113,113,.25); }
.btn-invoice { background: rgba(190,141,81,.15);  color: var(--gold); border: 1px solid rgba(190,141,81,.35); }
.btn-invoice:hover { background: rgba(190,141,81,.3); }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }

/* Modal refus */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 2rem; width: min(480px, 90vw); display: flex; flex-direction: column; gap: 1rem; }
.modal-box h3 { margin: 0; font-size: 1.1rem; }
.modal-box textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: var(--r); padding: .75rem; font-family: inherit; font-size: .9rem; resize: vertical; }
.modal-actions { display: flex; gap: .75rem; }

@media (max-width: 600px) {
    .devis-items-table thead { display: none; }
    .devis-items-table td { display: block; padding: .35rem 1rem; }
    .devis-items-table td:first-child { padding-top: .75rem; font-weight: 600; }
    .devis-items-table td:last-child { padding-bottom: .75rem; }
    .text-right { text-align: left; }
}
