/* ============================================================
   Hermès — Empire MAJD
   Palette : crème / teal / navy / ambre
   ============================================================ */

:root {
  --creme: #FDFAF5;
  --creme-2: #F5EFE4;
  --teal: #0D9488;
  --teal-2: #0F766E;
  --teal-soft: #CCFBF1;
  --navy: #1C1C2E;
  --navy-2: #2A2A3E;
  --ambre: #D97706;
  --ambre-soft: #FED7AA;
  --red: #DC2626;
  --green: #16A34A;
  --gray: #6B7280;
  --gray-2: #9CA3AF;
  --border: #E5E1D6;
  --shadow: 0 1px 2px rgba(28, 28, 46, 0.05),
            0 4px 12px rgba(28, 28, 46, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 240px;
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--navy);
  background: var(--creme);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-2); }

h1, h2, h3, h4 { margin: 0 0 0.6em; color: var(--navy); font-weight: 600; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

code, pre {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 13px;
}
pre {
  background: var(--navy);
  color: var(--creme);
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

/* ----- Layout ----- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

.sidebar {
  background: var(--navy);
  color: var(--creme);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  color: var(--creme);
}
.sidebar-brand .accent { color: var(--ambre); }
.sidebar-sub {
  font-size: 12px;
  color: var(--gray-2);
  margin-bottom: 22px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.nav { list-style: none; padding: 0; margin: 0 0 24px; }
.nav li { margin: 2px 0; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--creme);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--navy-2); }
.nav a.active {
  background: var(--teal);
  color: var(--creme);
  font-weight: 600;
}
.nav .nav-icon { width: 18px; text-align: center; opacity: 0.85; }

.sidebar-footer {
  position: sticky;
  bottom: 0;
  padding-top: 16px;
  border-top: 1px solid var(--navy-2);
  font-size: 12px;
  color: var(--gray-2);
}
.sidebar-footer a {
  color: var(--ambre-soft);
  display: block;
  margin-top: 6px;
}

.main {
  padding: 28px 36px;
  max-width: 1320px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { margin: 0; }
.page-header .meta {
  color: var(--gray);
  font-size: 13px;
}

/* ----- Cards / KPI tiles ----- */
.grid {
  display: grid;
  gap: 16px;
}
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 10px;
}
.kpi-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}
.kpi-sub {
  margin-top: 6px;
  color: var(--gray);
  font-size: 13px;
}
.kpi-up { color: var(--green); }
.kpi-down { color: var(--red); }

.progress {
  height: 8px;
  background: var(--creme-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--ambre));
  border-radius: 999px;
  transition: width 0.4s ease-out;
}

/* ----- Badges ----- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.badge-v3 { background: var(--teal-soft); color: var(--teal-2); }
.badge-v2 { background: var(--ambre-soft); color: var(--ambre); }
.badge-missing { background: #FEE2E2; color: var(--red); }
.badge-ok { background: #DCFCE7; color: var(--green); }
.badge-warn { background: #FEF3C7; color: var(--ambre); }

/* ----- Tables ----- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-weight: 600;
  font-size: 12px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--creme-2);
}
.table tr:hover td { background: var(--creme-2); }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  min-height: 44px;
}
.btn:hover { background: var(--teal-2); color: white; }
.btn-secondary {
  background: white;
  color: var(--navy);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--creme-2); color: var(--navy); }
.btn-amber { background: var(--ambre); }
.btn-amber:hover { background: #B45309; }

/* ----- Login ----- */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy), #2A2A3E);
  padding: 24px;
}
.login-card {
  background: white;
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 380px;
}
.login-card h1 {
  text-align: center;
  margin-bottom: 6px;
  color: var(--navy);
}
.login-card .tagline {
  text-align: center;
  color: var(--gray);
  font-size: 13px;
  margin-bottom: 22px;
}
.login-card input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  margin-bottom: 12px;
}
.login-card input[type="password"]:focus {
  outline: 2px solid var(--teal);
  outline-offset: 0;
  border-color: var(--teal);
}
.login-card .btn { width: 100%; justify-content: center; }
.login-card .error {
  background: #FEE2E2;
  color: var(--red);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ----- Alerts ----- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-warn { background: #FEF3C7; color: #92400E; border-left: 4px solid var(--ambre); }
.alert-info { background: var(--teal-soft); color: var(--teal-2); border-left: 4px solid var(--teal); }
.alert-error { background: #FEE2E2; color: var(--red); border-left: 4px solid var(--red); }

/* ----- Empty / placeholder ----- */
.placeholder {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}
.placeholder h2 { color: var(--gray); }

/* ----- Mobile ----- */
.sidebar-toggle {
  display: none;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 16px;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 80%;
    max-width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    z-index: 100;
    box-shadow: 0 0 32px rgba(0,0,0,0.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .main { padding: 18px 16px; }
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
