/* Styles du front de gestion — chargé par index.html */
:root {
  --green: #1a6b4a;
  --green-light: #2d8c63;
  --green-pale: #e8f5ef;
  --green-mid: #c2e4d4;
  --amber: #d4820a;
  --amber-pale: #fef3e2;
  --red: #c0392b;
  --red-pale: #fdecea;
  --blue: #1a5fa8;
  --blue-pale: #e8f0fb;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-dark: #d1d5db;
  --bg: #f7f8fa;
  --white: #ffffff;
  --sidebar-w: 220px;
  --header-h: 56px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

#login-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--green);
}
.login-card {
  background: var(--white); border-radius: 12px; padding: 40px 36px; width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-brand { font-family: 'DM Serif Display', serif; font-size: 24px; color: var(--green); margin-bottom: 2px; }
.login-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 26px; }
.login-error { background: var(--red-pale); color: var(--red); font-size: 12px; padding: 8px 10px; border-radius: 6px; margin-bottom: 14px; display: none; }

#app-shell { display: none; height: 100vh; }
#app-shell.active { display: flex; }

.sidebar { width: var(--sidebar-w); background: var(--green); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.sidebar-logo { padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.sidebar-logo .brand { font-family: 'DM Serif Display', serif; color: #fff; font-size: 17px; line-height: 1.2; }
.sidebar-logo .sub { color: rgba(255,255,255,0.6); font-size: 10px; letter-spacing: 0.5px; margin-top: 2px; }
.sidebar-section { padding: 10px 0 4px; }
.sidebar-section-title { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: rgba(255,255,255,0.4); padding: 0 16px 6px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 16px; cursor: pointer; color: rgba(255,255,255,0.75); font-size: 13px; border-left: 3px solid transparent; transition: all .15s; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.14); color: #fff; border-left-color: #a8e6c9; font-weight: 500; }
.nav-item .icon { width: 16px; text-align: center; font-size: 15px; flex-shrink: 0; }
.user-block { margin-top: auto; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.12); display: flex; align-items: center; gap: 10px; cursor: pointer; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.user-name { color: #fff; font-size: 12px; font-weight: 500; }
.user-role { color: rgba(255,255,255,0.5); font-size: 10px; text-transform: capitalize; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.header { height: var(--header-h); background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; flex-shrink: 0; }
.header-title { font-size: 16px; font-weight: 600; }
.header-sub { font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.btn { font-family: 'DM Sans', sans-serif; padding: 7px 16px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-light); }
.btn-outline { background: transparent; border: 1px solid var(--border-dark); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--red-pale); color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.content { flex: 1; overflow-y: auto; padding: 24px; }
.screen { display: none; }
.screen.active { display: block; }

.card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.card-title { font-size: 13px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--green); }
.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 600; font-family: 'DM Serif Display', serif; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.3px; border-bottom: 1px solid var(--border); text-transform: uppercase; }
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-green { background: var(--green-pale); color: var(--green); }
.badge-amber { background: var(--amber-pale); color: var(--amber); }
.badge-red { background: var(--red-pale); color: var(--red); }
.badge-blue { background: var(--blue-pale); color: var(--blue); }
.badge-gray { background: #f3f4f6; color: #6b7280; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.form-control, select.form-control { width: 100%; padding: 8px 10px; border: 1px solid var(--border-dark); border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 13px; }
.form-control:focus { outline: none; border-color: var(--green); }
.form-group { margin-bottom: 14px; }
.form-group label { font-size: 11px; font-weight: 500; color: var(--text-muted); display: block; margin-bottom: 4px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 100; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: 12px; padding: 24px; width: 460px; max-width: 95vw; max-height: 85vh; overflow-y: auto; }
.modal.wide { width: 820px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -6px 0 16px; }
.tab { padding: 8px 14px; font-size: 12px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--green); border-bottom-color: var(--green); }
.tab-pane { display: none; } .tab-pane.active { display: block; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-muted); } .kv dd { margin: 0; }
.row-clickable { cursor: pointer; } .row-clickable:hover { background: var(--bg); }
.modal-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.modal-close { cursor: pointer; font-size: 18px; color: var(--text-muted); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 13px; z-index: 200; display: none; }
.toast.error { background: var(--red); }
.toast.show { display: block; }
