:root {
    --bg: #0f0f0f;
    --bg2: #1a1a1a;
    --bg3: #242424;
    --border: #2e2e2e;
    --text: #f0f0f0;
    --text2: #888;
    --text3: #555;
    --blue: #c9a84c;
    --blue-dim: #3a2e10;
    --green: #22c55e;
    --orange: #f59e0b;
    --red: #ef4444;
    --radius: 6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar { background: var(--bg); border-bottom: 1px solid var(--border); padding: 0 24px; height: 52px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.nav-brand { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.nav-brand a { color: var(--text); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-user { display: none; }

/* Container */
.container { max-width: 1000px; margin: 0 auto; padding: 32px 20px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; font-size: 13px; font-weight: 500; transition: opacity .15s; text-decoration: none; background: none; }
.btn:hover { opacity: .8; text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-secondary { background: var(--bg3); color: var(--text); border-color: var(--border); }
.btn-warning { background: transparent; color: var(--orange); border-color: var(--orange); }
.btn-success { background: transparent; color: var(--green); border-color: var(--green); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* Badges */
.badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.badge-trial { background: var(--bg3); color: var(--orange); border: 1px solid var(--orange); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; border-left: 3px solid; }
.alert-error   { background: #1a0a0a; color: var(--red);   border-color: var(--red); }
.alert-success { background: #0a1a0f; color: var(--green); border-color: var(--green); }

/* Auth */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: url('/assets/bg-chantier.jpg') center center / cover no-repeat; position: relative; }
.auth-page::before { display: none; }
.auth-box { width: 100%; max-width: 380px; position: relative; z-index: 1; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); border-radius: 8px; padding: 32px; }
.auth-logo { font-size: 40px; margin-bottom: 12px; }
.auth-box h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-sub { color: var(--text2); font-size: 14px; margin-bottom: 32px; }
.auth-switch { font-size: 13px; margin-top: 24px; color: var(--text2); }
.trial-info { color: var(--green); font-size: 13px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }
input[type=text], input[type=email], input[type=password] {
    width: 100%; padding: 11px 14px; background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 15px; color: var(--text); outline: none; transition: border .15s;
}
input[type=text]::placeholder, input[type=email]::placeholder, input[type=password]::placeholder { color: var(--text3); }
input:focus { border-color: var(--blue); }

/* Stats bar */
.stats-bar { display: flex; gap: 32px; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.stat { display: flex; flex-direction: column; }
.stat-val { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.trial-limit .stat-val { color: var(--orange); }

/* New chantier */
.new-chantier-card { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.new-chantier-card h2 { font-size: 13px; font-weight: 500; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form .input-main { flex: 1; min-width: 200px; }
.inline-form input[type=text] { padding: 9px 12px; font-size: 14px; }

/* Chantiers grid */
.chantiers-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.chantier-card { background: var(--bg); padding: 20px 0; display: block; color: var(--text); text-decoration: none; transition: background .15s; border-bottom: 1px solid var(--border); }
.chantier-card:hover { background: var(--bg2); text-decoration: none; color: var(--text); }
.chantier-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 12px; }
.chantier-header h3 { font-size: 15px; font-weight: 600; }
.chantier-desc { font-size: 13px; color: var(--text2); margin-bottom: 14px; line-height: 1.4; }
.chantier-meta { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text3); }
.status-badge { font-size: 10px; padding: 2px 7px; border-radius: 3px; white-space: nowrap; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.status-en_cours { background: var(--blue-dim); color: var(--blue); }
.status-termine  { background: #0a1a0f; color: var(--green); }

/* Empty state */
.empty-state { padding: 64px 20px; text-align: center; color: var(--text3); }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .5; }
.empty-state p { font-size: 15px; line-height: 1.6; }

/* Upload zone */
.upload-zone { margin-bottom: 32px; display: flex; flex-direction: column; gap: 12px; }
.dropzone { border: 1px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center; background: var(--bg2); cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.dz-drag-hover { border-color: var(--blue); background: #0d1b2e; }
.dz-message { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dz-icon { font-size: 36px; }
.dz-message strong { font-size: 15px; }
.dz-message span { color: var(--text2); font-size: 13px; }
.dz-hint { font-size: 11px; color: var(--text3) !important; }
.camera-form { display: flex; }
.btn-camera { font-size: 15px; padding: 14px 24px; flex: 1; justify-content: center; }
.progress-bar-wrap { width: 100%; max-width: 280px; background: var(--bg3); border-radius: 99px; height: 4px; margin: 10px 0; }
.progress-bar { height: 100%; background: var(--blue); border-radius: 99px; transition: width .2s ease; }

/* Chantier title bar */
.chantier-title-bar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; flex-wrap: wrap; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.chantier-title-bar h1 { font-size: 22px; font-weight: 700; }
.chantier-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Gallery */
.gallery-header { margin-bottom: 16px; }
.gallery-header h2 { font-size: 13px; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; font-weight: 500; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px; }
.gallery-item { position: relative; background: var(--bg2); aspect-ratio: 4/3; cursor: pointer; overflow: visible; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; display: block; }
.gallery-item:hover img { transform: scale(1.04); }
.gallery-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,.75)); padding: 10px 8px 8px; display: flex; justify-content: space-between; align-items: flex-end; opacity: 0; transition: opacity .2s; }
.gallery-item:hover .gallery-overlay { opacity: 1; }
.photo-date { color: rgba(255,255,255,.8); font-size: 11px; }
.btn-delete { background: rgba(239,68,68,.8); color: #fff; border: none; border-radius: 3px; padding: 3px 7px; cursor: pointer; font-size: 12px; }

/* Tags */
.photo-tag { position: absolute; top: 6px; left: 6px; z-index: 2; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 3px; text-transform: uppercase; letter-spacing: .04em; }
.tag-avant    { background: #1d3a6e; color: #93c5fd; }
.tag-pendant  { background: #3a2e10; color: #c9a84c; }
.tag-apres    { background: #0a1a0f; color: #22c55e; }
.tag-probleme { background: #3a0a0a; color: #ef4444; }

.tag-picker { position: absolute; top: 0; left: 0; right: 0; z-index: 20; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 6px; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.6); }
.tag-picker button { width: 100%; padding: 9px 12px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; }
.tag-picker button:hover { background: var(--bg3); }
.tag-picker .tag-clear { color: var(--text2); border-color: transparent; font-size: 12px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.lightbox-bg { position: absolute; inset: 0; background: rgba(0,0,0,.95); }
.lightbox img { position: relative; max-width: 90vw; max-height: 90vh; object-fit: contain; }
.lightbox-close, .lightbox-prev, .lightbox-next { position: absolute; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.15); border-radius: 4px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev  { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,.2); }

@media (max-width: 640px) {
    .container { padding: 20px 16px; }
    .stats-bar { gap: 20px; }
    .chantiers-grid { grid-template-columns: 1fr; }
    .inline-form { flex-direction: column; }
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
    .chantier-title-bar { flex-direction: column; }
    .navbar { padding: 0 16px; }
}
