/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: 14px; color: #1e293b; background: #f1f5f9; }
a { text-decoration: none; color: inherit; }
.hidden { display: none !important; }

/* === LAYOUT === */
.app-layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; margin-left: 240px; padding: 28px 32px; min-height: 100vh; }
@media (max-width: 768px) { .main-content { margin-left: 0; padding: 16px; } }

/* === SIDEBAR === */
.sidebar { width: 240px; background: #0f2744; color: white; display: flex; flex-direction: column; position: fixed; height: 100vh; top: 0; left: 0; z-index: 100; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-icon { font-size: 22px; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 10px; color: rgba(255,255,255,.4); }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: rgba(255,255,255,.6); transition: all .15s; }
.nav-item:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.nav-item.active { background: rgba(255,255,255,.15); color: white; }
.nav-icon { font-size: 16px; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 32px; height: 32px; background: #f59e0b; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: white; flex-shrink: 0; }
.user-name { font-size: 12px; font-weight: 600; color: white; }
.user-role { font-size: 10px; color: rgba(255,255,255,.4); }
.user-info { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.btn-logout { color: rgba(255,255,255,.4); font-size: 16px; padding: 6px; border-radius: 6px; hover: background rgba(255,255,255,.1); flex-shrink: 0; }
.btn-logout:hover { color: white; background: rgba(255,255,255,.1); }

/* === PAGE HEADER === */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.subtitle { font-size: 13px; color: #64748b; margin-top: 3px; }
.breadcrumb { font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.breadcrumb a { color: #3b82f6; } .breadcrumb a:hover { text-decoration: underline; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 15px; font-weight: 600; color: #1e293b; margin-bottom: 12px; margin-top: 8px; }
.actor-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { background: #e2e8f0; color: #475569; padding: 2px 8px; border-radius: 4px; font-size: 11px; }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; white-space: nowrap; }
.btn-primary { background: #1e4b8f; color: white; }
.btn-primary:hover { background: #1a3f7a; }
.btn-secondary { background: white; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }
.btn-green { background: #16a34a; color: white; }
.btn-green:hover { background: #15803d; }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.mt-2 { margin-top: 8px; }

/* === FORMS === */
.form-grid { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.form-card { background: white; border-radius: 12px; border: 1px solid #e2e8f0; padding: 20px; }
.form-section-title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid #f1f5f9; }
.form-actions { display: flex; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-label, .label { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .4px; }
.input { width: 100%; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 12px; font-size: 13px; color: #1e293b; background: white; outline: none; transition: border .15s; font-family: inherit; }
.input:focus { border-color: #1e4b8f; box-shadow: 0 0 0 3px rgba(30,75,143,.1); }
.input-sm { width: 130px; padding: 5px 8px; font-size: 12px; }
.inline-form { display: flex; gap: 4px; align-items: center; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; margin-top: 4px; }

/* === CARDS === */
.card { background: white; border-radius: 12px; border: 1px solid #e2e8f0; padding: 20px; }
.mb-6 { margin-bottom: 24px; }

/* === STATS === */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
.stat-card { background: white; border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 8px; border: 1px solid #e2e8f0; }
.stat-icon { font-size: 20px; }
.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: #64748b; font-weight: 500; }
.stat-blue .stat-num { color: #1e4b8f; }
.stat-indigo .stat-num { color: #4f46e5; }
.stat-red .stat-num { color: #dc2626; }
.stat-green .stat-num { color: #16a34a; }

/* === CHANTIER CARDS === */
.chantier-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 800px) { .chantier-grid { grid-template-columns: 1fr; } }
.chantier-card { background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s; }
.chantier-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.chantier-card-header { display: flex; gap: 12px; align-items: flex-start; }
.chantier-logo { width: 44px; height: 36px; object-fit: contain; border-radius: 6px; border: 1px solid #e2e8f0; }
.chantier-logo-placeholder { width: 44px; height: 36px; background: #e8f0fe; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.chantier-info h3 { font-weight: 600; color: #0f172a; font-size: 14px; }
.chantier-adresse { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.chantier-meta { display: flex; gap: 12px; font-size: 12px; color: #64748b; }

/* === LIST CARDS === */
.list-cards { display: flex; flex-direction: column; gap: 8px; }
.list-card { background: white; border: 1px solid #e2e8f0; border-radius: 10px; display: flex; align-items: center; padding: 12px 14px; gap: 12px; transition: box-shadow .15s; }
.list-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.list-card-link { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.list-card-icon { font-size: 20px; flex-shrink: 0; }
.pv-icon { background: #eef2ff; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 18px; }
.list-card-body { flex: 1; min-width: 0; }
.list-card-title { font-weight: 600; color: #0f172a; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-card-meta { display: flex; gap: 12px; font-size: 11px; color: #94a3b8; margin-top: 3px; flex-wrap: wrap; }
.list-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* === PROGRESS === */
.progress-wrap, .progress-inline { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; min-width: 60px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e); border-radius: 3px; transition: width .3s; }
.progress-pct, .progress-inline span { font-size: 11px; font-weight: 600; color: #374151; flex-shrink: 0; }
.progress-lg { height: 8px; min-width: 120px; }

/* === CHANTIER STATS BAR === */
.chantier-stats-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.cs-item { background: white; border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; border: 1px solid #e2e8f0; }
.cs-num { font-size: 22px; font-weight: 700; }
.cs-label { font-size: 11px; color: #64748b; }
.cs-red .cs-num { color: #dc2626; }
.cs-green .cs-num { color: #16a34a; }
.cs-blue { flex: 1; }
.cs-pct { font-size: 15px; font-weight: 700; color: #374151; flex-shrink: 0; }

/* === BADGES === */
.badge { padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-green { background: #dcfce7; color: #15803d; }

/* === TABS === */
.tabs { display: flex; gap: 4px; background: #f1f5f9; border-radius: 10px; padding: 4px; width: fit-content; margin-bottom: 20px; }
.tab-btn { padding: 8px 18px; border-radius: 7px; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 500; color: #64748b; transition: all .15s; }
.tab-btn.active { background: white; color: #0f172a; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === TOOLBAR === */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.filter-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn { padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; border: 1px solid #e2e8f0; background: white; color: #64748b; transition: all .15s; }
.filter-btn:hover { border-color: #93c5fd; }
.filter-btn.active { background: #1e4b8f; color: white; border-color: #1e4b8f; }
.filter-btn span { opacity: .7; }

/* === RESERVES === */
.reserves-list { display: flex; flex-direction: column; gap: 8px; }
.reserve-card { background: white; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
.reserve-card.res-ouverte { border-left: 3px solid #ef4444; }
.reserve-card.res-encours { border-left: 3px solid #f59e0b; }
.reserve-card.res-levee { border-left: 3px solid #22c55e; }
.reserve-header { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; background: #fafafa; transition: background .1s; }
.reserve-header:hover { background: #f1f5f9; }
.reserve-num { width: 32px; height: 32px; border-radius: 8px; background: #eef2ff; color: #1e4b8f; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.reserve-summary { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.lot-badge { background: #1e4b8f; color: white; padding: 1px 7px; border-radius: 10px; font-size: 11px; flex-shrink: 0; }
.loc-text { font-size: 11px; color: #94a3b8; flex-shrink: 0; }
.reserve-desc-preview { font-size: 13px; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.reserve-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.delai-text, .photo-count { font-size: 11px; color: #94a3b8; }
.statut-badge { padding: 2px 8px; border-radius: 12px; font-size: 10px; font-weight: 600; color: white; }
.statut-ouverte { background: #ef4444; }
.statut-en_cours { background: #f59e0b; }
.statut-levee { background: #22c55e; }
.toggle-icon { font-size: 11px; color: #94a3b8; }
.reserve-body { padding: 14px; border-top: 1px solid #f1f5f9; }
.reserve-full-desc { font-size: 13px; color: #374151; line-height: 1.6; margin-bottom: 10px; }
.reserve-dates { display: flex; gap: 16px; font-size: 12px; color: #64748b; margin-bottom: 10px; }
.photos-section { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.photo-thumb-wrap { position: relative; }
.photo-thumb { width: 80px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid #e2e8f0; cursor: pointer; }
.photo-delete { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; background: #ef4444; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; opacity: 0; transition: opacity .15s; }
.photo-thumb-wrap:hover .photo-delete { opacity: 1; }
.photo-add { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px dashed #cbd5e1; border-radius: 8px; font-size: 12px; color: #64748b; cursor: pointer; transition: border .15s; }
.photo-add:hover { border-color: #1e4b8f; color: #1e4b8f; }
.reserve-actions { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid #f1f5f9; }

/* === TABLE === */
.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0; }
.data-table th { background: #f8fafc; padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid #e2e8f0; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.text-center { text-align: center; }
.text-green { color: #16a34a; }
.text-gray { color: #94a3b8; }

/* === MODALS === */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal { background: white; border-radius: 14px; width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #f1f5f9; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #94a3b8; padding: 4px; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid #f1f5f9; display: flex; gap: 8px; }

/* === LIGHTBOX === */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 2000; cursor: pointer; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; object-fit: contain; }

/* === ALERTS === */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* === LOGIN === */
.login-page { background: linear-gradient(135deg, #0f2744 0%, #1e4b8f 100%); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-box { background: white; border-radius: 16px; padding: 36px 32px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-icon { font-size: 40px; margin-bottom: 8px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: #0f172a; }
.login-logo p { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-hint { font-size: 11px; color: #94a3b8; text-align: center; margin-top: 16px; }
.login-hint code { background: #f1f5f9; padding: 2px 5px; border-radius: 4px; font-family: monospace; }

/* === LOGO UPLOAD === */
.logo-upload-row { display: flex; gap: 16px; align-items: flex-start; }
.logo-preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
#logo-preview { width: 110px; height: 70px; object-fit: contain; border-radius: 8px; border: 1px solid #e2e8f0; }
.logo-placeholder { width: 110px; height: 70px; background: #f1f5f9; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #94a3b8; border: 2px dashed #cbd5e1; }
.flex-1 { flex: 1; }

/* === SEARCH === */
.search-bar { margin-bottom: 16px; }
.search-input { max-width: 400px; }

/* === EMPTY STATE === */
.empty-state { background: white; border: 1px solid #e2e8f0; border-radius: 12px; text-align: center; padding: 48px 32px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { color: #64748b; margin-bottom: 16px; }

/* === ITALIC === */
.italic { font-style: italic; }
