:root {
  --bg: #020617;
  --panel: #111827;
  --card: #1f2937;
  --card-soft: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --success-hover: #15803d;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --warning: #f59e0b;
  --border: #334155;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  --radius: 16px;
  --radius-sm: 12px;
  --header-h: 60px;
}

/* Reset */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

body.menu-open {
  overflow: hidden;
}

a {
  color: inherit;
}

/* Header / Burger */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.burger-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.burger-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.topbar-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.side-menu-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 2px;
}

.side-menu-logo img {
  width: 60px;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}

/* Side menu */
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: min(280px, 82vw);
  height: 100vh;
  height: 100dvh; /* mobile : tient compte des barres du navigateur */
  padding-top: 0; /* le logo du menu remplace l'espace réservé au topbar */
  background: var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 1200;
  overflow-y: auto;               /* le menu défile lui-même */
  overscroll-behavior: contain;   /* le scroll ne se propage pas au fond */
  -webkit-overflow-scrolling: touch;
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu a {
  display: block;
  width: 100%;
  padding: 9px 14px;
  text-decoration: none;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: .95rem;
}

.side-menu a:hover {
  background: #1f2937;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1150;
  touch-action: none; /* bloque le scroll du fond à travers l'overlay (mobile) */
}

.menu-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Layout */
.container,
.main-content {
  padding: 20px;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.card {
  padding: 18px;
}

.narrow {
  max-width: 900px;
}

/* Typography */
h1,
h2,
h3 {
  margin-top: 0;
}

h2 {
  margin-bottom: 12px;
}

/* Dashboard cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card strong {
  font-size: 2rem;
}

.card.alert {
  border-color: var(--danger);
}

/* Flash */
.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.flash.success {
  background: rgba(22, 163, 74, 0.18);
  border-color: rgba(22, 163, 74, 0.35);
}

.flash.error {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.35);
}

/* Forms */
.form-grid {
  display: grid;
  gap: 14px;
}

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

.inline input {
  width: auto;
}

.inline-form {
  display: grid;
  grid-template-columns: 1.5fr 120px 100px;
  gap: 10px;
  align-items: center;
}

label {
  display: block;
  font-size: 0.95rem;
}

input,
select,
textarea,
button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-height: 40px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn:hover {
  background: var(--primary-hover);
}

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

.small {
  padding: 8px 10px;
  min-height: 36px;
  font-size: 0.92rem;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.ot-toolbar-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  width: 100%;
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
}

.searchbar input[type="text"] {
  flex: 1 1 auto;
  min-width: 180px;
}

.searchbar select {
  width: auto;
  min-width: 210px;
}

.searchbar button,
.searchbar .btn {
  width: auto;
  flex: 0 0 auto;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--text);
}

.checkbox-inline input {
  width: auto;
  margin: 0;
}

.ot-toolbar-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

.ot-toolbar-buttons .btn {
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

.row-alert {
  background: var(--danger-soft);
}

.badge.danger {
  display: inline-block;
  padding: 10px 12px;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid var(--danger);
  border-radius: 999px;
}

/* Result box */
.result-box {
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  background: var(--card-soft);
  border: 1px solid var(--border);
}

/* OT cards */
.ot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.ot-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  min-height: 220px;
}

.ot-card-alert {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.3);
}

.ot-card-soustraitant {
  border-color: #a78bfa;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.ot-card-termine {
  border-color: rgba(22, 163, 74, 0.6);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.25);
}

/* ── Badge statut unifié OT + Maintenance ── */
.card-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.csb-encours {
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.35);
  color: #a5b4fc;
}
.csb-termine {
  background: rgba(22,163,74,.15);
  border: 1px solid rgba(22,163,74,.4);
  color: #86efac;
}
.csb-soustraitant {
  background: rgba(139,92,246,.15);
  border: 1px solid rgba(139,92,246,.4);
  color: #c4b5fd;
}
.csb-alert {
  background: rgba(220,38,38,.15);
  border: 1px solid rgba(220,38,38,.4);
  color: #fca5a5;
}

.ot-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.ot-number {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  word-break: break-word;
}

.ot-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ot-site,
.ot-date {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.ot-summary {
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.45;
  min-height: 50px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ot-icons {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  flex-wrap: wrap;
}

.ot-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-soft);
  border: 1px solid var(--border);
  font-size: 1.2rem;
}

.ot-icon-alert {
  border-color: var(--danger);
  color: #fca5a5;
}

.ot-icon-en-progression {
  background: rgba(16, 185, 129, .15);
  border-color: rgba(16, 185, 129, .45);
  color: #6ee7b7;
}

.ot-icon-a-planifier {
  background: rgba(245, 158, 11, .15);
  border-color: rgba(245, 158, 11, .4);
  color: #fcd34d;
}

/* Maintenance cards */
.maint-info-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.4;
}

.maint-info-row .mdi {
  flex-shrink: 0;
  margin-top: 2px;
}

.maint-info-late {
  color: #fca5a5;
}

.maint-divider {
  border-top: 1px solid var(--border);
  margin: 2px 0;
}

.maint-badge-late {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ── Auth pages ───────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 0 40px rgba(37, 99, 235, 0.1);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.auth-logo img {
  width: 150px;
  height: 150px;
  display: block;
  margin: 0 auto;
}

.auth-logo span {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.auth-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin: 0;
}

.auth-link {
  font-size: .85rem;
  color: var(--muted);
  text-decoration: none;
  text-align: center;
  transition: color .2s;
}

.auth-link:hover {
  color: #60a5fa;
}

/* ── Topbar right section (bell + user) ────────────────── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding-right: 4px;
}

/* ── Topbar user info ──────────────────────────────────── */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-user-name {
  font-size: .85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ── Role badges ──────────────────────────────────────── */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.role-admin {
  background: rgba(139, 92, 246, .18);
  border-color: rgba(139, 92, 246, .45);
  color: #c4b5fd;
}

.role-responsable {
  background: rgba(37, 99, 235, .18);
  border-color: rgba(37, 99, 235, .45);
  color: #93c5fd;
}

.role-technicien {
  background: rgba(6, 182, 212, .15);
  border-color: rgba(6, 182, 212, .4);
  color: #67e8f9;
}

/* ── Side menu extras ─────────────────────────────────── */
.side-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-menu a .mdi {
  font-size: 1.1rem;
  flex-shrink: 0;
  opacity: .7;
}

.side-menu-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 4px 0;
}

.side-menu-section {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,.3);
  padding: 8px 14px 2px;
  pointer-events: none;
}

.side-menu-logout {
  color: #fca5a5 !important;
}

.side-menu-logout .mdi {
  color: #fca5a5;
}

/* ── Readonly block (technicien view) ─────────────────── */
.readonly-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 12px;
  background: var(--card-soft);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.readonly-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: .93rem;
}

.readonly-row span {
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Assignment rows (ot_detail / maintenance_detail) ─── */
.assign-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--card-soft);
  border: 1px solid var(--border);
}

.assign-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .93rem;
}

.assign-meta {
  font-size: .8rem;
  color: var(--muted);
  padding-left: 22px;
}

.assign-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 22px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.assign-ack {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 22px;
  margin-top: 4px;
  font-size: .8rem;
  color: #6ee7b7;
}

.assign-ack .mdi {
  font-size: 1rem;
}

.assign-ack-btn {
  padding-left: 22px;
  margin-top: 6px;
}

.btn-ack {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(16,185,129,.5);
  background: rgba(16,185,129,.12);
  color: #6ee7b7;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-ack:hover,
.btn-ack:active {
  background: rgba(16,185,129,.25);
  border-color: rgba(16,185,129,.7);
}

.assign-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}

.assign-status-en-attente {
  background: rgba(245,158,11,.15);
  border: 1px solid rgba(245,158,11,.4);
  color: #fcd34d;
}

.assign-status-en-cours {
  background: rgba(37,99,235,.18);
  border: 1px solid rgba(37,99,235,.45);
  color: #93c5fd;
}

.assign-status-planifié,
.assign-status-planifi\E9  {
  background: rgba(37,99,235,.18);
  border: 1px solid rgba(37,99,235,.45);
  color: #93c5fd;
}

.assign-status-à-planifier {
  background: rgba(245,158,11,.15);
  border: 1px solid rgba(245,158,11,.4);
  color: #fcd34d;
}

.assign-status-terminé,
.assign-status-termin\E9  {
  background: rgba(22,163,74,.15);
  border: 1px solid rgba(22,163,74,.4);
  color: #86efac;
}

/* ── Detail head ──────────────────────────────────────── */
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

/* ── Dashboard futuriste ──────────────────────────────── */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  margin-bottom: 24px;
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(37,99,235,0.07) 0%, transparent 60%);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.dash-label {
  font-weight: 700;
  color: #60a5fa;
  letter-spacing: 0.14em;
}

.dash-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: dash-pulse 2s ease-in-out infinite;
}

@keyframes dash-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #22c55e; }
  50%       { opacity: 0.55; box-shadow: 0 0 16px #22c55e; }
}

.dash-status-text {
  color: #22c55e;
  font-weight: 600;
  font-size: 0.75rem;
}

.dash-date {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: #60a5fa;
  letter-spacing: 0.1em;
}

/* Section labels */
.dash-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.dash-section-label::before,
.dash-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
}

.dash-section-label .mdi {
  font-size: 1rem;
  flex-shrink: 0;
}

.dash-section-blue {
  color: #60a5fa;
  margin-top: 4px;
}
.dash-section-blue::before { background: linear-gradient(to right, transparent, #2563eb); }
.dash-section-blue::after  { background: linear-gradient(to left,  transparent, #2563eb); }

.dash-section-orange {
  color: #fbbf24;
  margin-top: 8px;
}
.dash-section-orange::before { background: linear-gradient(to right, transparent, #f59e0b); }
.dash-section-orange::after  { background: linear-gradient(to left,  transparent, #f59e0b); }

/* Stat cards */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

/* Vignettes mises en avant (Total HT), côte à côte au-dessus des autres */
.dash-stats-highlight {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.dash-stat-card-highlight {
  padding: 24px 22px;
}

.dash-stat-card-highlight .dash-stat-icon {
  font-size: 2.6rem;
}

.dash-stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--card);
  text-decoration: none;
  overflow: hidden;
  min-width: 0;
  transition: transform 0.2s ease, box-shadow 0.25s ease;
}

.dash-stat-card:hover {
  transform: translateY(-4px);
}

.dash-stat-blue                   { border-color: rgba(37,99,235,0.4); }
.dash-stat-blue:hover             { box-shadow: 0 0 32px rgba(37,99,235,0.22); }

.dash-stat-red                    { border-color: rgba(220,38,38,0.35); }
.dash-stat-red:hover              { box-shadow: 0 0 32px rgba(220,38,38,0.22); }
.dash-stat-red.dash-stat-active   { border-color: rgba(220,38,38,0.7); box-shadow: 0 0 20px rgba(220,38,38,0.18); }

.dash-stat-cyan                   { border-color: rgba(6,182,212,0.4); }
.dash-stat-cyan:hover             { box-shadow: 0 0 32px rgba(6,182,212,0.18); }

.dash-stat-orange                 { border-color: rgba(245,158,11,0.35); }
.dash-stat-orange:hover           { box-shadow: 0 0 32px rgba(245,158,11,0.18); }
.dash-stat-orange.dash-stat-active{ border-color: rgba(245,158,11,0.7); box-shadow: 0 0 20px rgba(245,158,11,0.18); }

.dash-stat-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.dash-stat-icon {
  font-size: 2rem;
  flex-shrink: 0;
  opacity: 0.9;
}

.dash-stat-blue   .dash-stat-icon { color: #60a5fa; }
.dash-stat-red    .dash-stat-icon { color: #f87171; }
.dash-stat-cyan   .dash-stat-icon { color: #22d3ee; }
.dash-stat-orange .dash-stat-icon { color: #fbbf24; }

.dash-stat-value {
  font-size: 2.6rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  line-height: 1;
  color: #fff;
  word-break: break-all;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Valeurs textuelles (heures) : taille adaptée */
.dash-stat-value:not([data-count]) {
  font-size: clamp(1.2rem, 3.5vw, 2rem);
  word-break: break-word;
}

/* Montants (Total HT) : reste sur une seule ligne, taille adaptée à la largeur */
.dash-stat-value.dash-stat-value-eur {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}

.dash-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 5px;
}

.dash-stat-sublabel {
  font-size: 0.72rem;
  color: #f87171;
  margin-top: 3px;
  font-style: italic;
}

.dash-stat-glow {
  position: absolute;
  bottom: -40px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  opacity: 0.07;
  pointer-events: none;
}

.dash-stat-blue   .dash-stat-glow { background: #2563eb; }
.dash-stat-red    .dash-stat-glow { background: #dc2626; }
.dash-stat-cyan   .dash-stat-glow { background: #06b6d4; }
.dash-stat-orange .dash-stat-glow { background: #f59e0b; }

/* Dash panel */
.dash-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.dash-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.dash-panel-header .mdi {
  font-size: 1.2rem;
  color: #60a5fa;
}

.dash-panel-header h2 {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.dash-import-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-import-row {
  display: grid;
  grid-template-columns: 10px 1fr 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--card-soft);
  border: 1px solid rgba(51,65,85,0.5);
  font-size: 0.87rem;
}

.dash-import-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #334155;
  border: 1px solid #475569;
}

.dash-import-date {
  font-family: 'Courier New', monospace;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.dash-import-file {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-import-chips {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.dash-chip {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.73rem;
  background: rgba(51,65,85,0.7);
  border: 1px solid var(--border);
  white-space: nowrap;
  color: var(--muted);
}

.dash-chip-blue {
  background: rgba(37,99,235,0.18);
  border-color: rgba(37,99,235,0.4);
  color: #93c5fd;
}

.dash-chip-red {
  background: rgba(220,38,38,0.15);
  border-color: rgba(220,38,38,0.4);
  color: #fca5a5;
}

/* ── Notifications in-app ────────────────────────────────── */
.notif-bell {
  position: relative;
}

.notif-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 1.3rem;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  line-height: 1;
  transition: background .15s;
}
.notif-btn:hover { background: var(--card); }

.notif-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  background: var(--danger);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  line-height: 1;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  max-height: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  flex-shrink: 0;
}

.notif-mark-all {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: .75rem;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background .15s;
}
.notif-mark-all:hover { background: var(--card); }

.notif-list {
  overflow-y: auto;
  flex: 1;
}

.notif-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}

.notif-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--card); }

.notif-item.notif-unread {
  background: rgba(37,99,235,.08);
  border-left: 3px solid var(--primary);
  padding-left: 11px;
}
.notif-item.notif-unread:hover { background: rgba(37,99,235,.14); }

.notif-item-title {
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 2px;
}
.notif-item-msg {
  font-size: .77rem;
  color: var(--muted);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-item-time {
  font-size: .68rem;
  color: var(--muted);
  opacity: .65;
}

.dash-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

@media (max-width: 600px) {
  .dash-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .dash-import-row {
    grid-template-columns: 10px 1fr;
    grid-template-rows: auto auto auto;
  }
  .dash-import-date  { grid-column: 2; }
  .dash-import-file  { grid-column: 2; }
  .dash-import-chips { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Utility */
.hidden {
  display: none !important;
}

/* Tablet */
@media (max-width: 900px) {
  .container,
  .main-content {
    padding: 16px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 680px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  @media (max-width: 768px) {
  .ot-toolbar-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .searchbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    flex: none;
  }

  .searchbar input[type="text"],
  .searchbar select,
  .searchbar button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: normal;
  }

  .checkbox-inline input {
    width: auto;
    flex: 0 0 auto;
  }

  .ot-toolbar-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .ot-toolbar-buttons .btn {
    width: 100%;
    justify-content: center;
  }
}
/* ── Anti-zoom iOS ──────────────────────────────────────────────
   Safari (iPhone/iPad) zoome automatiquement sur tout champ dont la
   police fait moins de 16px. On force 16px sur mobile — le !important
   couvre aussi les styles inline des templates. */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="tel"],
  input[type="url"],
  input:not([type]),
  select,
  textarea {
    font-size: 16px !important;
  }
}
