:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #0f172a;
  --panel-2: #11182b;
  --border: #1f2937;
  --muted: #9ca3af;
  --text: #e5e7eb;
  --primary: #fb923c;
  --primary-2: #f97316;
  --success: #22c55e;
  --warn: #fbbf24;
  --danger: #ef4444;
  --accent: #38bdf8;
}

body.theme-light {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #e5e7eb;
  --muted: #6b7280;
  --text: #0f172a;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #0a0f1c;
  border-right: 1px solid var(--border);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
body.theme-light .sidebar {
  background: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.08), rgba(56, 189, 248, 0.05));
  flex-shrink: 0;
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #1f2937;
  font-size: 18px;
}

.brand-title {
  font-weight: 800;
  letter-spacing: 0.3px;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  margin-right: -4px;
}

.nav::-webkit-scrollbar {
  width: 6px;
}

.nav::-webkit-scrollbar-track {
  background: transparent;
}

.nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.nav::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.nav-section {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s ease;
  font-weight: 600;
}

.nav-item i {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: #1f2937;
}
body.theme-light .nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: #d1d5db;
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.15), rgba(251, 146, 60, 0.05));
  border-color: rgba(251, 146, 60, 0.5);
  color: #fff;
}
body.theme-light .nav-item.active {
  color: var(--text);
  background: rgba(251, 146, 60, 0.15);
}

.chevron {
  margin-left: auto;
}

.nav-sub {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0 6px 18px;
  margin-bottom: 6px;
  border-left: 1px solid var(--border);
}

.nav-sub.open {
  display: flex;
}

.nav-sub-item {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 2px;
  cursor: pointer;
  text-align: left;
  transition: color 0.12s ease, background 0.12s ease, padding 0.12s ease;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
}

.nav-sub-item:hover {
  color: var(--text);
  background: rgba(251, 146, 60, 0.12);
  padding-left: 6px;
}

.nav-sub-item.active {
  color: var(--text);
  font-weight: 700;
  background: rgba(251, 146, 60, 0.2);
}

.content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  background: radial-gradient(circle at 15% 20%, rgba(251, 146, 60, 0.07), transparent 35%), radial-gradient(circle at 80% 0%, rgba(56, 189, 248, 0.05), transparent 30%), var(--bg);
}
body.theme-light .content {
  background: var(--bg);
}
body.theme-light {
  color: var(--text);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(10, 15, 28, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.autofill-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.autofill-trap input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
body.theme-light .topbar {
  background: rgba(255, 255, 255, 0.92);
}

.search {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  width: 100%;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-mobile-toggle {
  display: none !important;
}

.notif-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.12s ease;
}

.icon-btn.ghost {
  background: transparent;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: #fff;
}

.badge-dot {
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50%;
  position: relative;
  right: -4px;
  top: -12px;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-weight: 700;
  font-size: 13px;
}

.pill-ok {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
}

.pill-warn {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.3);
}

.profile {
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name {
  font-weight: 700;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fb923c, #f97316);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #0b1220;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  min-width: 160px;
  display: none;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.35);
}

.profile-dropdown.open {
  display: block;
}

.profile-dropdown button {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.profile-dropdown button:hover {
  background: rgba(255, 255, 255, 0.04);
}

.main {
  padding: 20px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.page {
  min-width: 0;
}

.page[hidden] {
  display: none !important;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.2);
}
body.theme-light .card {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-title {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.card-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
body.theme-light .card-title,
body.theme-light .card-sub,
body.theme-light .kpi-value,
body.theme-light .kpi-label,
body.theme-light .kpi-trend,
body.theme-light .muted,
body.theme-light label,
body.theme-light th,
body.theme-light td,
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  color: var(--text);
}
body.theme-light .muted,
body.theme-light .card-sub,
body.theme-light label,
body.theme-light th {
  color: var(--muted);
}

.file-input {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.file-input input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-label {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.file-btn {
  pointer-events: none;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.kpi-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
}

.kpi-icon.success { color: var(--success); }
.kpi-icon.info { color: var(--accent); }
.kpi-icon.accent { color: var(--primary); }
.kpi-icon.warn { color: var(--warn); }

.kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.kpi-value {
  margin: 4px 0;
  font-size: 24px;
  font-weight: 800;
}

.kpi-trend {
  margin: 0;
  font-size: 13px;
}
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend.neutral { color: var(--warn); }

.grid-2 {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid-3 {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.chart-card {
  min-height: 260px;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}
.chip.green { color: var(--success); border-color: rgba(34,197,94,0.35); }
.chip.warn { color: var(--warn); border-color: rgba(251,191,36,0.35); }
.chip.danger { color: var(--danger); border-color: rgba(239,68,68,0.35); }

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card .card-head {
  padding: 14px 16px 0;
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--border);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive > table {
  min-width: 960px;
}

.table-wrap.scrollable {
  max-height: 360px;
}

.chart-card canvas {
  width: 100% !important;
  height: 240px !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.success { background: rgba(34,197,94,0.15); color: var(--success); }
.status-pill.warn { background: rgba(251,191,36,0.15); color: var(--warn); }
.status-pill.danger { background: rgba(239,68,68,0.15); color: var(--danger); }
body.theme-light .status-pill { color: var(--text); }

.link-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.visibility-checkboxes { margin-top: 8px; }
.visibility-checkboxes .visibility-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.visibility-checkboxes .visibility-row input[type="checkbox"] { flex-shrink: 0; width: 18px; height: 18px; margin: 0; }

.select-compact {
  padding: 4px 8px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-width: 0;
  cursor: pointer;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.payment-online {
  color: #16a34a;
}

.payment-cash {
  color: #dc2626;
}

.source-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.source-pill.source-pos {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}
.source-pill.source-webshop {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}
.source-pill.source-other {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.orders-actions {
  align-items: center;
  gap: 8px;
}

.orders-actions .btn {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  height: 32px;
  display: inline-flex;
  align-items: center;
}

.orders-actions label {
  margin-bottom: 0;
}

.orders-actions #bulk-order-btn {
  color: #fff;
}

.orders-actions select {
  min-width: 140px;
  height: 32px;
}

.orders-actions > div {
  align-items: center;
}

.orders-actions .bulk-order-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.orders-actions .bulk-order-label {
  font-size: 12px;
  white-space: nowrap;
}

.orders-actions #bulk-order-status {
  width: auto;
  min-width: 200px;
  height: 32px;
  line-height: 32px;
  padding: 0 10px;
}

.btn.warn {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #111827;
}

.btn {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  transition: all 0.12s ease;
  color: #fff;
}

.btn.sm {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.btn.primary { background: linear-gradient(135deg, #fb923c, #f97316); }
.btn.accent { background: linear-gradient(135deg, #22d3ee, #38bdf8); }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn.danger { background: linear-gradient(135deg, #ef4444, #dc2626); }

.btn:hover { transform: translateY(-1px); }

.placeholder {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
}

.output {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--muted);
  white-space: pre-wrap;
}

.sidebar-collapsed .sidebar {
  width: 84px;
  padding: 18px 10px;
}
.sidebar-collapsed .nav-item span,
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-section {
  display: none;
}
.sidebar-collapsed .brand {
  justify-content: center;
}
.sidebar-collapsed .layout {
  grid-template-columns: 84px 1fr;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 280px);
    max-width: 280px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 20;
  }
  body:not(.sidebar-hidden) .sidebar {
    transform: translateX(0);
  }
  .content {
    margin-left: 0;
  }
  .main {
    padding: 16px;
  }
  .card {
    padding: 14px;
  }
  .topbar {
    padding: 12px 14px;
  }
  .search {
    max-width: none;
  }
  #clock,
  #auth-status {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .profile-meta {
    display: none;
  }
  .profile-trigger {
    padding: 6px;
  }
  .sidebar-mobile-toggle {
    display: grid !important;
  }
  .profile-dropdown {
    right: 0;
    left: auto;
    width: min(88vw, 220px);
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .topbar-actions {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
  }
  .topbar-actions > * {
    flex-shrink: 0;
  }
  .pill {
    padding: 6px 10px;
    font-size: 12px;
  }
  .card-head {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .main {
    padding: 12px;
    gap: 12px;
  }
  .kpi-grid,
  .grid-2,
  .grid-3,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .orders-actions .bulk-order-group {
    flex-wrap: wrap;
    width: 100%;
  }
  .orders-actions select,
  .orders-actions #bulk-order-status {
    min-width: 0;
    width: 100%;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  th,
  td {
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }
  .order-management-table th,
  .order-management-table td {
    padding: 8px 10px;
  }
  .order-management-date-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .order-management-date-header .order-management-date-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .settings-section-content {
    padding: 14px;
  }
  .table-responsive > table {
    min-width: 760px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 10px;
  }
  .main {
    padding: 10px;
  }
  .card {
    border-radius: 12px;
    padding: 12px;
  }
  .btn {
    width: 100%;
    justify-content: center;
  }
  #clock,
  #auth-status {
    max-width: 120px;
    width: auto;
    text-align: left;
  }
  .actions .btn.ghost,
  .actions .btn.primary,
  .actions .btn.danger,
  .actions .btn.accent,
  .actions .btn.warn {
    width: 100%;
  }
  .orders-actions .btn {
    width: auto;
  }
  .table-responsive > table {
    min-width: 680px;
  }
}

/* Category Sections Collapsibles */
.category-section {
  margin-bottom: 24px;
}

.category-header {
  user-select: none;
  transition: background 0.2s ease;
}

.category-header:hover {
  background: var(--panel) !important;
}

.category-content {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 5000px;
  }
}

.category-chevron {
  flex-shrink: 0;
}

/* Modal Styles */
.modal-overlay {
  animation: fadeIn 0.2s ease;
}

/* Modal détail commande (dashboard) */
.order-detail-modal-overlay {
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}

.order-detail-shell {
  width: 100%;
  max-width: 920px;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
  animation: orderDetailSlide 0.25s ease;
}

@keyframes orderDetailSlide {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.order-detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--panel-2) 0%, var(--panel) 100%);
}

.order-detail-top h2 {
  margin: 0 0 6px 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.order-detail-top-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.order-detail-body {
  padding: 20px 22px 22px;
  overflow-y: auto;
  flex: 1;
}

.order-detail-sections {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .order-detail-sections {
    grid-template-columns: 1fr;
  }
}

.order-detail-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--panel-2);
}

.order-detail-section-title {
  margin: 0 0 12px 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.order-detail-dl {
  display: grid;
  gap: 8px 12px;
}

.order-detail-dl > div {
  display: grid;
  grid-template-columns: minmax(110px, 38%) 1fr;
  gap: 8px;
  font-size: 13px;
  align-items: start;
}

.order-detail-dl dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.order-detail-dl dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

.order-detail-code {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  background: var(--panel);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  word-break: break-all;
  margin-top: 4px;
}

.order-detail-lines-title {
  margin: 0 0 12px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.order-detail-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-detail-line {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--panel);
}

.order-detail-line-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.order-detail-line-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  flex: 1;
  min-width: 160px;
}

.order-detail-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--primary);
}

.order-detail-line-prices {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.order-detail-line-prices strong {
  color: var(--text);
  font-weight: 700;
}

.order-detail-line-notes {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 10px 0;
}

.order-detail-subblock {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
}

.order-detail-subblock-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  font-size: 12px;
}

.order-detail-sublist {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
}

.order-detail-sublist li {
  margin-bottom: 4px;
}

.order-detail-empty {
  margin: 0;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.order-detail-dl-compact {
  font-size: 12px;
}

.order-detail-dl-compact dt {
  color: var(--muted, #64748b);
}

.order-detail-tech {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--border, #e2e8f0) 80%, transparent);
}

.order-detail-tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 6px;
}

.order-detail-tech-table th,
.order-detail-tech-table td {
  border: 1px solid var(--border, #e2e8f0);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.order-detail-tech-table th {
  background: color-mix(in srgb, var(--surface-2, #f1f5f9) 90%, transparent);
  font-weight: 600;
}

.order-detail-json {
  margin-top: 20px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface, #fff);
}

.order-detail-json summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  background: color-mix(in srgb, var(--surface-2, #f8fafc) 100%, transparent);
}

.order-detail-json pre {
  margin: 0;
  padding: 12px 14px;
  max-height: 280px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.45;
  background: #0f172a;
  color: #e2e8f0;
}

.order-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.card.soft {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

/* Settings Sections Collapsibles */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.collapsible-header:hover {
  background: var(--panel-2);
}

.collapsible-header.expanded .chevron {
  transform: rotate(180deg);
}

.collapsible-content {
  padding: 20px;
}

.collapsible-content[hidden] {
  display: none;
}

.settings-section {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
}

.settings-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s ease;
}

.settings-section-header:hover {
  background: var(--panel);
}

.settings-section-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-chevron {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
  color: var(--muted);
}

.settings-section-content {
  padding: 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  animation: slideDown 0.3s ease;
}

.notification-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification-setting-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
}

.notification-setting-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #22c55e;
}

.notification-setting-subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 22px;
  padding: 6px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}

.notification-setting-subitem input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #22c55e;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.theme-light .settings-section {
  background: #f8fafc;
}

body.theme-light .settings-section-header:hover {
  background: #ffffff;
}

body.theme-light .settings-section-content {
  background: #ffffff;
}

/* Gestion de commande (order management) — affichage dates / catégories / produits */
.order-management-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-management-date {
  margin-bottom: 0;
}

.order-management-date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-management-date-header .order-management-date-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.order-management-date-header .order-management-date-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.order-management-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--muted);
}

.order-management-chip {
  font-size: 12px;
  padding: 4px 10px;
}

.order-management-date-body {
  padding: 16px 20px;
}

.order-management-categories {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-management-category {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.order-management-category-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}

.order-management-category-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.order-management-category-body {
  padding: 0;
}

.order-management-table-wrap {
  overflow: auto;
  border: none;
  border-top: none;
}

.order-management-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.order-management-table th,
.order-management-table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.order-management-table thead th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.order-management-table tbody tr:last-child td {
  border-bottom: none;
}

.order-management-table tbody tr:hover {
  background: var(--panel-2);
}

.order-mgmt-qty,
.order-mgmt-th-qty {
  text-align: right;
  width: 100px;
}

body.theme-light .order-management-category {
  background: #ffffff;
}

body.theme-light .order-management-category-head {
  background: #f8fafc;
}

.business-type-option {
  color: var(--text) !important;
}

.business-type-option span {
  color: var(--text) !important;
  font-weight: 500;
}

/* Styles pour le sélecteur de langue */
.language-selector {
  position: relative;
}

#lang-btn,
#notif-btn,
#theme-toggle {
  width: 40px;
  height: 40px;
  padding: 8px;
}

.language-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  font-size: 14px;
}

.lang-flag {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
  flex: 0 0 auto;
}

.language-option:hover {
  background: var(--panel-2);
}

.language-option.active {
  background: var(--primary);
  color: #fff;
}

/* Styles pour les notifications */
#notif-btn {
  position: relative;
}

.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  display: none;
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  transform: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(92vw, 420px);
  min-width: 0;
  max-width: 420px;
  max-height: 500px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.notification-section {
  padding: 8px 0;
}

.notification-section-title {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.12s ease;
  position: relative;
}

.notification-item:hover {
  background: var(--panel-2);
}

.notification-item.unread {
  background: rgba(251, 146, 60, 0.05);
}

.notification-item.unread:hover {
  background: rgba(251, 146, 60, 0.1);
}

.notification-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  color: var(--primary);
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.notification-message {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1.4;
}

.notification-time {
  font-size: 11px;
  color: var(--muted);
}

.notification-dot {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}

.notification-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.notification-empty i {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.notification-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.notification-mark-read {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.notification-mark-read:hover {
  background: var(--panel);
  border-color: var(--primary);
  color: var(--primary);
}

.notification-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  width: min(92vw, 400px);
  min-width: 0;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  transform: translateX(400px);
  transition: transform 0.3s ease;
}

.notification-toast.show {
  transform: translateX(0);
}

.notification-toast-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notification-toast-content i {
  color: var(--primary);
  flex-shrink: 0;
}

.notification-toast-content > div {
  flex: 1;
}

.notification-toast-content strong {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.notification-toast-content p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.notification-toast-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.12s ease;
}

.notification-toast-close:hover {
  background: var(--panel-2);
  color: var(--text);
}

/* Styles pour les résultats de recherche */
.search {
  position: relative;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 1001;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 500px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
}

.search-results-section {
  padding: 8px 0;
}

.search-results-section-title {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.search-result-item:hover {
  background: var(--panel-2);
}

.search-result-item i {
  color: var(--primary);
  flex-shrink: 0;
}

.search-result-content {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.search-result-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.search-results-empty,
.search-results-error {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.search-results-empty i,
.search-results-error i {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Responsive utility classes for inline-style cleanup */
.inline-grid-single {
  grid-template-columns: 1fr;
}

.customer-search-input,
.support-filter-customer {
  min-width: 220px;
}

.stock-category-form {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: end;
}

.stock-category-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.stock-items-form {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px 180px;
  gap: 12px;
  align-items: start;
}

.opening-hours-builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

/* Horaires d'ouverture : visibles en thème clair et nuit */
.opening-day-row {
  background: var(--panel-2);
  color: var(--text);
}
.opening-day-row .muted {
  color: var(--muted);
}
.opening-day-row input[type="time"],
.opening-day-row input[type="text"] {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.opening-day-row button.btn,
.opening-day-row .btn {
  color: var(--text);
}
.opening-day-row label {
  color: var(--text);
}

.delivery-zone-grid {
  grid-template-columns: 1fr 1fr;
}

.delivery-zone-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.delivery-rule-row {
  display: grid;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.delivery-rule-row-standard {
  grid-template-columns: minmax(0, 1fr) 140px 120px auto;
}

.delivery-rule-row-postal {
  grid-template-columns: 140px minmax(0, 1fr) 140px 120px auto;
}

#security-users-tbody td:last-child {
  min-width: 260px;
}

.security-user-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.business-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  column-gap: 16px;
  row-gap: 10px;
  align-items: start;
}

@media (max-width: 1080px) {
  .business-type-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 720px) {
  .customer-search-input,
  .support-filter-customer {
    min-width: 0;
    width: 100%;
  }
  .stock-items-form {
    grid-template-columns: 1fr;
  }
  .delivery-zone-grid {
    grid-template-columns: 1fr;
  }
  .delivery-zone-actions {
    justify-content: flex-start;
  }
  .delivery-rule-row-standard,
  .delivery-rule-row-postal {
    grid-template-columns: 1fr;
  }
  .delivery-rule-row .btn {
    width: 100%;
    justify-content: center;
  }
  #security-users-tbody td:last-child {
    min-width: 220px;
  }
  .security-user-actions {
    display: flex;
    width: 100%;
  }
  .security-user-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .business-type-grid {
    grid-template-columns: 1fr;
  }
  .language-dropdown {
    right: 0;
    left: auto;
    transform: none;
    width: min(90vw, 220px);
    min-width: 0;
  }
  .notifications-dropdown {
    right: 0;
  }
  .notification-toast {
    right: 4vw;
    top: 14px;
    width: min(92vw, 360px);
  }
  .search-results {
    max-height: 65vh;
  }
  .notification-item {
    padding: 10px 12px;
  }
  .notification-title {
    font-size: 13px;
  }
  .notification-message {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .notifications-dropdown {
    right: 0;
    width: min(96vw, 420px);
  }
}
