/* ══════════════════════════════════════════
   TEAMTIM ADMIN — CSS
   Sidebar sombre + contenu clair
══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 240px;
  --sidebar-bg: #111318;
  --sidebar-hover: #1e2028;
  --sidebar-active: #1e2028;
  --sidebar-border: #2a2d38;
  --accent: #7C3151;
  --accent-light: #F8EDF3;
  --bg: #f4f5f7;
  --white: #ffffff;
  --dark: #1a1a2e;
  --gray: #6b7280;
  --gray2: #9ca3af;
  --border: #e5e7eb;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --font: 'Inter', -apple-system, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--dark);
  display: flex;
  overflow: hidden;
}

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 300;
  transition: transform .3s ease;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.logo-tt {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.logo-brand {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

.logo-sub {
  font-size: 0.68rem;
  color: #666;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-group-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #555;
  padding: 14px 16px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.82rem;
  font-weight: 400;
  color: #a0a8b8;
  transition: background .15s, color .15s;
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.badge-nav {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: 14px 16px;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.admin-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: #fff;
}

.admin-role {
  font-size: 0.65rem;
  color: #666;
  margin-top: 2px;
}

.view-site {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #666;
  transition: color .2s;
}
.view-site:hover { color: var(--accent); }

/* ════════════════════════════════════════
   MAIN
════════════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ════════════════════════════════════════
   TOPBAR
════════════════════════════════════════ */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--dark);
  padding: 4px;
}

.topbar-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray);
  flex: 1;
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  position: relative;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray);
  border-radius: 8px;
  transition: background .2s;
}
.topbar-btn:hover { background: var(--bg); }

.dot-notif {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--white);
}

/* ════════════════════════════════════════
   PAGES
════════════════════════════════════════ */
.page {
  display: none;
  padding: 24px;
  flex: 1;
}

.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark);
}

.page-sub {
  font-size: 0.82rem;
  color: var(--gray);
  margin-top: 2px;
}

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, transform .1s;
  white-space: nowrap;
}
.btn-primary:hover { background: #5a52d5; }
.btn-primary:active { transform: scale(.97); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  color: var(--dark);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}
.btn-secondary:hover { background: var(--bg); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  color: var(--gray);
  transition: background .2s, color .2s;
}
.btn-icon:hover { background: var(--bg); color: var(--dark); }
.btn-icon.del:hover { background: #fef2f2; color: var(--red); }

.link-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-family: var(--font);
  font-size: inherit;
}
.link-btn:hover { text-decoration: underline; }

/* ════════════════════════════════════════
   KPI CARDS
════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
}

.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-orange { background: #fff7ed; color: var(--orange); }
.kpi-green  { background: #ecfdf5; color: var(--green); }
.kpi-blue   { background: #eff6ff; color: var(--blue); }
.kpi-purple { background: #f5f3ff; color: var(--purple); }

.kpi-label {
  font-size: 0.75rem;
  color: var(--gray);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
}

.kpi-cur { font-size: 0.8rem; font-weight: 400; }

.kpi-trend {
  font-size: 0.72rem;
  margin-top: 4px;
}
.kpi-trend.up   { color: var(--green); }
.kpi-trend.down { color: var(--red); }

/* ════════════════════════════════════════
   CARDS
════════════════════════════════════════ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
}

.card-lg { overflow-x: auto; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
}

.link-see-all {
  font-size: 0.75rem;
  color: var(--accent);
}
.link-see-all:hover { text-decoration: underline; }

/* ════════════════════════════════════════
   DATA TABLE
════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #f3f4f6;
  color: var(--dark);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }

.data-table-full { min-width: 700px; }

.td-id { font-weight: 600; color: var(--gray); font-size: 0.75rem; }

/* ════════════════════════════════════════
   STATUS BADGES
════════════════════════════════════════ */
.status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-new     { background: #eff6ff; color: var(--blue); }
.status-confirm { background: #ecfdf5; color: var(--green); }
.status-ship    { background: #fff7ed; color: var(--orange); }
.status-done    { background: #f0fdf4; color: #16a34a; }
.status-cancel  { background: #fef2f2; color: var(--red); }

/* ════════════════════════════════════════
   FILTERS BAR
════════════════════════════════════════ */
.filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  flex-wrap: wrap;
}

.ftab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.ftab.active { background: var(--accent); color: #fff; }
.ftab:not(.active):hover { background: var(--bg); color: var(--dark); }

.ftab-count {
  background: rgba(0,0,0,.08);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.65rem;
}
.ftab.active .ftab-count { background: rgba(255,255,255,.25); }

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.82rem;
  background: var(--white);
  min-width: 240px;
  outline: none;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* ════════════════════════════════════════
   PRODUCT ADMIN GRID
════════════════════════════════════════ */
.product-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.product-admin-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}

.product-admin-card .prod-img-wrap {
  aspect-ratio: 2/3;
  overflow: hidden;
  background: #f3f4f6;
  position: relative;
}

.product-admin-card .prod-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.product-admin-card:hover .prod-img-wrap img { transform: scale(1.04); }

.prod-epuise-tag {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 3px 7px;
  border-radius: 4px;
}

.prod-admin-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity .2s;
}
.product-admin-card:hover .prod-admin-actions { opacity: 1; }

.prod-action-btn {
  width: 28px; height: 28px;
  background: var(--white);
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--gray);
  transition: background .2s, color .2s;
}
.prod-action-btn:hover { background: var(--accent); color: #fff; }
.prod-action-btn.del:hover { background: var(--red); color: #fff; }

.product-admin-card .prod-info {
  padding: 10px 12px;
}

.product-admin-card .prod-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-admin-card .prod-price {
  font-size: 0.75rem;
  color: var(--gray);
}

.product-admin-card .prod-stock {
  font-size: 0.68rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stock-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.stock-dot.red    { background: var(--red); }
.stock-dot.orange { background: var(--orange); }
.stock-dot.yellow { background: #eab308; }
.stock-dot.green  { background: var(--green); }

/* ════════════════════════════════════════
   COLLECTIONS ADMIN GRID
════════════════════════════════════════ */
.collections-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.col-admin-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}

.col-admin-card .col-img-wrap {
  aspect-ratio: 3/4;
  background: #f3f4f6;
  overflow: hidden;
  position: relative;
}

.col-admin-card .col-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.col-admin-card:hover .col-img-wrap img { transform: scale(1.04); }

.col-label-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,.88);
  padding: 6px 10px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.col-admin-actions {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

/* ════════════════════════════════════════
   STOCK LIST
════════════════════════════════════════ */
.stock-list { display: flex; flex-direction: column; gap: 10px; }

.stock-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stock-info p {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--dark);
}

.stock-qty {
  font-size: 0.7rem;
  color: var(--gray);
}

/* ════════════════════════════════════════
   NEWSLETTER STAT
════════════════════════════════════════ */
.newsletter-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}
.ns-num { font-size: 1.8rem; font-weight: 700; color: var(--dark); }
.ns-label { font-size: 0.78rem; color: var(--gray); }

.ns-bar-wrap {
  background: var(--bg);
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.ns-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.ns-goal { font-size: 0.72rem; color: var(--gray); }

/* ════════════════════════════════════════
   MÉDIATHÈQUE
════════════════════════════════════════ */
.dimensions-guide {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.dimensions-guide h3 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--dark);
}

.dim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.dim-card { text-align: center; }

.dim-preview {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
}
.dim-preview span {
  font-size: 0.65rem;
  color: rgba(255,255,255,.8);
  font-weight: 500;
}

.dim-name { font-size: 0.75rem; font-weight: 600; color: var(--dark); }
.dim-size { font-size: 0.72rem; color: var(--accent); font-weight: 600; margin: 2px 0; }
.dim-ratio { font-size: 0.68rem; color: var(--gray); }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 20px;
  background: var(--white);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.drop-zone p { font-size: 0.85rem; color: var(--gray); margin-top: 10px; }
.drop-hint { font-size: 0.72rem !important; color: var(--gray2) !important; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.media-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  cursor: pointer;
  group: true;
}
.media-item img, .media-item video {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.media-item:hover img, .media-item:hover video { transform: scale(1.05); }

.media-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity .2s;
}
.media-item:hover .media-overlay { opacity: 1; }

.media-type-badge {
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

/* ════════════════════════════════════════
   HERO ADMIN
════════════════════════════════════════ */
.hero-admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.hero-slot-preview {
  aspect-ratio: 16/9;
  background: #f3f4f6;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.hero-slot-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.hero-slot-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
.hero-slot-preview:hover .hero-slot-overlay { opacity: 1; }
.hero-slot-overlay button {
  background: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

.slot-label { font-size: 0.82rem; font-weight: 600; color: var(--dark); margin-top: 10px; }
.slot-dim { font-size: 0.72rem; color: var(--gray); }

.hero-text-edit {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.hero-text-edit h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--dark);
}

/* ════════════════════════════════════════
   BLOG ADMIN
════════════════════════════════════════ */
.blog-admin-list { display: flex; flex-direction: column; gap: 12px; }

.blog-admin-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.blog-thumb {
  width: 72px; height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f3f4f6;
}

.blog-meta { flex: 1; }
.blog-title-text { font-size: 0.88rem; font-weight: 600; color: var(--dark); margin-bottom: 3px; }
.blog-excerpt { font-size: 0.75rem; color: var(--gray); }

.blog-admin-actions { display: flex; gap: 6px; }

/* ════════════════════════════════════════
   SETTINGS
════════════════════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.settings-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════ */
.form-row {
  margin-bottom: 14px;
}

.form-row label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--dark);
  background: var(--white);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea.form-input { resize: vertical; min-height: 80px; }

.form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
  color: var(--dark);
}
.toggle-row:last-child { border-bottom: none; }

.toggle {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ════════════════════════════════════════
   UPLOAD ZONE (inside modal)
════════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  aspect-ratio: 2/3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: border-color .2s, background .2s;
  overflow: hidden;
  position: relative;
}
.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-zone p {
  font-size: 0.8rem;
  color: var(--gray);
}
.upload-dim {
  font-size: 0.7rem !important;
  color: var(--accent) !important;
  font-weight: 600;
}

/* ════════════════════════════════════════
   MODALS
════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
}

.modal-wide { max-width: 620px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 0.95rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--gray);
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background .2s;
}
.modal-close:hover { background: var(--bg); color: var(--dark); }

.modal-body { padding: 20px; overflow-y: auto; }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════
   TOAST
════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  transform: translateY(80px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  z-index: 2000;
  max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ════════════════════════════════════════
   ORDER DETAIL (modal body)
════════════════════════════════════════ */
.order-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.order-detail-block h4 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 8px;
}
.order-detail-block p {
  font-size: 0.83rem;
  color: var(--dark);
  margin-bottom: 4px;
}
.order-items-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.order-items-table th { text-align: left; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.7rem; text-transform: uppercase; color: var(--gray); letter-spacing: .06em; }
.order-items-table td { padding: 8px 0; border-bottom: 1px solid #f3f4f6; }

.order-status-select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .hero-admin-grid { grid-template-columns: 1fr; }
  .order-detail-grid { grid-template-columns: 1fr; }
  .form-2col { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page { padding: 16px; }
}

/* ════════════════════════════════════════
   INVOICE TYPE TOGGLE
════════════════════════════════════════ */
.invoice-type-toggle {
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.inv-type-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gray);
  transition: background .15s, color .15s;
}
.inv-type-btn.active {
  background: var(--white);
  color: var(--dark);
  box-shadow: var(--shadow);
}

/* ════════════════════════════════════════
   INVOICE OPTIONS BAR
════════════════════════════════════════ */
.invoice-options-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.inv-opt-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}
.inv-opt-group label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray);
}
.inv-opt-group select,
.inv-opt-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: var(--font);
  font-size: 0.8rem;
  background: var(--white);
  outline: none;
  color: var(--dark);
}
.inv-opt-group select:focus,
.inv-opt-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.inv-opt-input { width: 100%; }

/* ════════════════════════════════════════
   INVOICE PREVIEW WRAPPER
════════════════════════════════════════ */
.modal-invoice-outer {
  max-width: 860px !important;
  max-height: 95vh;
}

.invoice-preview-wrap {
  padding: 20px;
  background: #f4f5f7;
  overflow-y: auto;
  max-height: calc(95vh - 280px);
}

/* ════════════════════════════════════════
   INVOICE DOCUMENT
════════════════════════════════════════ */
.invoice-doc {
  background: var(--white);
  border-radius: 10px;
  padding: 36px 40px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  font-size: 0.85rem;
  max-width: 780px;
  margin: 0 auto;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.inv-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.inv-logo {
  width: 48px; height: 48px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.inv-brand-name {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  margin-bottom: 4px;
}

.inv-brand-tagline {
  font-size: 0.7rem;
  color: var(--gray);
}

.inv-meta { text-align: right; }

.inv-doc-type {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  line-height: 1;
}

.inv-meta-table { border-collapse: collapse; margin-left: auto; }
.inv-meta-table td {
  padding: 3px 6px;
  font-size: 0.78rem;
}
.inv-meta-table td:first-child {
  color: var(--gray);
  font-weight: 600;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.inv-meta-table td:last-child {
  font-weight: 600;
  text-align: right;
  padding-left: 14px;
}

.inv-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* Parties (émetteur / client) */
.inv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 4px;
}

.inv-party p {
  margin: 2px 0;
  color: var(--dark);
  font-size: 0.82rem;
}

.inv-party-label {
  font-size: 0.6rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.18em !important;
  text-transform: uppercase !important;
  color: var(--gray2) !important;
  margin-bottom: 6px !important;
}

.inv-party-name {
  font-size: 1rem !important;
  font-weight: 700 !important;
  margin-bottom: 6px !important;
}

.inv-party-right { text-align: right; }

/* Items table */
.inv-items-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.inv-items-table th {
  padding: 10px 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray);
  border-bottom: 2px solid var(--dark);
  text-align: left;
}

.inv-items-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
  vertical-align: top;
}

.inv-items-table tr:last-child td { border-bottom: none; }

.inv-th-desc, .inv-td-desc { width: auto; }
.inv-th-qty, .inv-td-qty   { width: 56px; text-align: center; }
.inv-th-price, .inv-td-price { width: 110px; text-align: right; }
.inv-th-total, .inv-td-total { width: 120px; text-align: right; font-weight: 600; }

/* Totals */
.inv-totals-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.inv-totals { width: 300px; }

.inv-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.83rem;
  color: var(--dark);
  border-bottom: 1px solid #f3f4f6;
}
.inv-total-row:last-child { border-bottom: none; }

.inv-grand-total {
  font-weight: 700 !important;
  font-size: 1.05rem !important;
  padding: 10px 0 !important;
  color: var(--dark) !important;
}

/* Status pills on invoice */
.inv-status-paid {
  background: #ecfdf5; color: var(--green);
  padding: 2px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
}
.inv-status-pending {
  background: #fffbeb; color: var(--orange);
  padding: 2px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
}
.inv-status-cancel {
  background: #fef2f2; color: var(--red);
  padding: 2px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
}

/* Delivery info block */
.inv-delivery-info {
  background: #f8fafc;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.inv-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray2);
  margin-bottom: 10px;
}

.inv-delivery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.inv-del-key {
  font-size: 0.65rem;
  color: var(--gray2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 3px;
}

.inv-del-val {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--dark);
}

/* Invoice footer */
.inv-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 12px;
}

.inv-footer p { margin: 2px 0; font-size: 0.82rem; font-weight: 500; }
.inv-footer-sub { font-size: 0.7rem !important; color: var(--gray2) !important; }
.inv-footer-legal { font-size: 0.65rem; color: #d1d5db; text-align: right; }

/* ════════════════════════════════════════
   DELIVERY ZONES
════════════════════════════════════════ */
.zones-full-grid, .zones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.zone-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.zone-card-top {
  padding: 16px 18px;
  background: var(--white);
}

.zone-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 3px;
}

.zone-delay {
  font-size: 0.75rem;
  color: var(--gray);
  margin-bottom: 6px;
}

.zone-desc {
  font-size: 0.75rem;
  color: var(--gray2);
  line-height: 1.5;
}

.zone-price-badge {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.zone-card-edit {
  padding: 12px 18px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.zone-price-input { font-weight: 600; color: var(--accent); }

/* ════════════════════════════════════════
   PRINT STYLES
════════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .modal-overlay:not(#modal-invoice),
  .invoice-options-bar, .modal-header, .modal-footer,
  .invoice-type-toggle { display: none !important; }

  body { background: white !important; margin: 0; padding: 0; }

  .invoice-preview-wrap {
    padding: 0 !important;
    background: white !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .invoice-doc {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 20mm !important;
    max-width: 100% !important;
  }

  .modal-invoice-outer {
    max-width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  .modal-overlay#modal-invoice {
    position: static !important;
    background: none !important;
    padding: 0 !important;
  }

  @page { size: A4; margin: 0; }
}
