/* ============================================================
   GEA Maintenance Manager — Shared Styles
   ============================================================ */

:root {
  --primary: #0303B8;
  --primary-light: #0071CE;
  --accent: #00A0E1;
  --success: #28a745;
  --warning: #e6a000;
  --danger: #ff0019;
  --info: #17a2b8;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1a2332;
  --text-muted: #6c7a8d;
  --border: #d0d9e4;
  --sidebar-width: 232px;
  --header-height: 56px;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,48,135,0.10);
  --shadow-md: 0 4px 16px rgba(0,48,135,0.14);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--nav-color, var(--primary));
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  text-decoration: none;
}

.logo-badge {
  background: #fff;
  color: var(--primary);
  font-weight: 800;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.logo-title {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  opacity: 0.92;
}

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

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.sidebar nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: var(--accent);
}

.sidebar nav a svg { flex-shrink: 0; opacity: 0.85; }
.sidebar nav a.active svg { opacity: 1; }

.sidebar-section {
  padding: 8px 18px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
  margin-top: 6px;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  text-align: center;
}

/* ── Main Content ─────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 4px rgba(0,48,135,0.06);
  position: relative;
}

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

.page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

#company-name {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.date-display {
  background: var(--bg);
  padding: 4px 10px;
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--primary);
}

.content {
  flex: 1;
  padding: 24px;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 18px; }

.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Metric Cards ─────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 4px solid var(--primary-light);
}

.metric-card.danger  { border-left-color: var(--danger); }
.metric-card.warning { border-left-color: var(--warning); }
.metric-card.success { border-left-color: var(--success); }
.metric-card.info    { border-left-color: var(--info); }

.metric-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.metric-card .metric-icon { background: rgba(0,113,206,0.1); }
.metric-card.danger .metric-icon { background: rgba(220,53,69,0.1); }
.metric-card.warning .metric-icon { background: rgba(230,160,0,0.1); }
.metric-card.success .metric-icon { background: rgba(40,167,69,0.1); }
.metric-card.info .metric-icon { background: rgba(23,162,184,0.1); }

.metric-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
}

.metric-card.danger  .metric-value { color: var(--danger); }
.metric-card.warning .metric-value { color: var(--warning); }
.metric-card.success .metric-value { color: var(--success); }

.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

/* ── Grid Layouts ─────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.gap-20 { gap: 20px; }
.mb-20 { margin-bottom: 20px; }
.mb-16 { margin-bottom: 16px; }
.mb-8  { margin-bottom: 8px; }

/* ── Tables ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: #f6f8fb;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

table tbody tr:hover { background: #f9fbff; }

table tfoot td {
  padding: 10px 12px;
  font-weight: 700;
  background: #f6f8fb;
  border-top: 2px solid var(--border);
}

.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.nowrap { white-space: nowrap; }

/* ── Badges / Status ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-danger  { background: #fde8ea; color: #b02a37; }
.badge-warning { background: #fff3cd; color: #8a6200; }
.badge-success { background: #d4edda; color: #155724; }
.badge-info    { background: #cff4fc; color: #0c5460; }
.badge-primary { background: #cce0f5; color: #003087; }
.badge-muted   { background: #e9ecef; color: #495057; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
  gap: 4px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: #002070; }

.btn-secondary {
  background: var(--primary-light);
  color: #fff;
}
.btn-secondary:hover { background: #005cb8; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1e7e34; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #ff0019; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #c58800; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); border-color: var(--primary-light); }

.btn-icon {
  padding: 6px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg); color: var(--primary); border-color: var(--primary-light); }
.btn-icon.danger { color: var(--danger); border-color: var(--danger); }
.btn-icon.danger:hover { background: var(--danger); color: #fff; }

.btn-group { display: flex; gap: 6px; align-items: center; }

/* ── Forms ────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

label .required { color: var(--danger); margin-left: 2px; }
label .optional { color: var(--text-muted); font-weight: 400; font-size: 0.75rem; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
select,
textarea {
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(0,113,206,0.1);
}

input[disabled], select[disabled], textarea[disabled] {
  background: #f6f8fb;
  color: var(--text-muted);
  cursor: not-allowed;
}

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

.form-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.form-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.form-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Toggle / Checkbox styled */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.toggle {
  position: relative;
  width: 40px; height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  cursor: pointer;
  transition: 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--primary-light); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

.toggle-label { font-size: 0.84rem; font-weight: 500; }

/* ── Section Header ───────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

/* ── Alert Banner ─────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-danger  { background: #fde8ea; border-left: 4px solid var(--danger); color: #721c24; }
.alert-warning { background: #fff3cd; border-left: 4px solid var(--warning); color: #664d03; }
.alert-info    { background: #cff4fc; border-left: 4px solid var(--info); color: #0c5460; }
.alert-success { background: #d4edda; border-left: 4px solid var(--success); color: #155724; }

/* ── Urgency Colors ───────────────────────────────────── */
.urgency-overdue { color: var(--danger); font-weight: 700; }
.urgency-urgent  { color: var(--warning); font-weight: 700; }
.urgency-soon    { color: var(--info); }
.urgency-ok      { color: var(--success); }

.row-overdue { background: #fff5f5 !important; }
.row-urgent  { background: #fffdf0 !important; }

/* ── Calendar ─────────────────────────────────────────── */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cal-month-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 160px;
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-header {
  padding: 8px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cal-day {
  min-height: 90px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px;
  overflow: hidden;
}

.cal-day.other-month { background: #f9fafb; opacity: 0.6; }
.cal-day.today { border-color: var(--primary-light); box-shadow: 0 0 0 2px rgba(0,113,206,0.2); }
.cal-day.weekend { background: #fafafa; }

.cal-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.cal-day.today .cal-day-num { color: var(--primary-light); font-weight: 800; }

.cal-event {
  font-size: 0.7rem;
  padding: 2px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.cal-event.maintenance { background: #cce0f5; color: #003087; }
.cal-event.overdue     { background: #fde8ea; color: #b02a37; }
.cal-event.silicone    { background: #d4edda; color: #155724; }
.cal-event.commande    { background: #fff3cd; color: #664d03; }

/* ── Calendrier (page dédiée) ─────────────────────────── */
.legend { display:flex;gap:6px;align-items:center;flex-wrap:wrap;font-size:0.8rem }
.leg-dot { width:12px;height:12px;border-radius:3px;flex-shrink:0 }
.cal-filter { display:flex;align-items:center;gap:5px;cursor:pointer;border-radius:14px;padding:4px 10px;border:1.5px solid transparent;transition:all 0.15s;user-select:none }
.cal-filter:hover { border-color:rgba(0,0,0,0.15);background:rgba(0,0,0,0.03) }
.cal-filter.inactive { opacity:0.28 }
.cal-filter.inactive .leg-dot { filter:grayscale(1) }

/* Month grid */
.cal-grid { display:grid;grid-template-columns:repeat(7,1fr);gap:1px;background:var(--border) }
.cal-day-header { background:#f0f4f8;padding:6px;text-align:center;font-size:0.75rem;font-weight:700;color:var(--text-muted) }
.cal-day { background:#fff;min-height:110px;padding:4px;font-size:0.75rem;transition:background 0.1s;cursor:default;position:relative }
.cal-day.drag-over { background:#e8f4fd!important;outline:2px dashed var(--primary-light) }
.cal-day.other-month { background:#f8fafc }
.cal-day.today .cal-day-num { background:var(--primary);color:#fff;border-radius:50%;width:22px;height:22px;display:flex;align-items:center;justify-content:center }
.cal-day.weekend { background:#fafafa }
.cal-day-num { font-weight:600;margin-bottom:3px;font-size:0.78rem;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px }

/* Scrollable events container inside each day cell */
.cal-day-inner { max-height:80px;overflow-y:auto;overflow-x:hidden }
.cal-day-inner::-webkit-scrollbar { width:3px }
.cal-day-inner::-webkit-scrollbar-thumb { background:#c1c9d2;border-radius:2px }
.cal-day-inner::-webkit-scrollbar-track { background:transparent }

/* Events (calendrier page) */
.cal-event {
  display:flex;align-items:center;gap:3px;
  border-radius:3px;padding:3px 5px;margin-bottom:2px;
  font-size:0.72rem;font-weight:500;line-height:1.3;
  cursor:grab;user-select:none;position:relative;
}
.cal-event-label { flex:1;min-width:0;word-break:break-word }
.val-btn {
  flex-shrink:0;display:none;
  background:rgba(255,255,255,0.85);border:1px solid rgba(0,0,0,0.18);
  border-radius:3px;cursor:pointer;font-size:0.62rem;padding:1px 4px;
  font-weight:800;line-height:1.2;color:#166534;
}
.cal-event:hover .val-btn { display:inline-block }
.cal-event.maintenance { background:#dbeafe;color:#1e40af }
.cal-event.silicone    { background:#dcfce7;color:#166534 }
.cal-event.overdue     { background:#fee2e2;color:#991b1b }
.cal-event.commande    { background:#fef3c7;color:#92400e }
.cal-event.dragging    { opacity:0.5 }

/* Year view */
.year-grid { display:grid;grid-template-columns:repeat(4,1fr);gap:16px }
@media(max-width:900px) { .year-grid { grid-template-columns:repeat(2,1fr) } }
.mini-month { border:1px solid var(--border);border-radius:6px;overflow:hidden }
.mini-month-title { background:#f0f4f8;padding:6px 10px;font-size:0.8rem;font-weight:700;color:var(--primary);text-align:center;cursor:pointer }
.mini-month-title:hover { background:#e0ecff }
.mini-cal { display:grid;grid-template-columns:repeat(7,1fr);gap:0 }
.mini-day-hdr { font-size:0.62rem;text-align:center;color:var(--text-muted);padding:2px 0 }
.mini-day { font-size:0.65rem;text-align:center;padding:2px;position:relative;line-height:1.4;border-radius:3px }
.mini-day.today-m { background:var(--primary);color:#fff;border-radius:50% }
.mini-day.other-m { color:#ccc }
.mini-day.has-event::after { content:'';display:block;width:4px;height:4px;background:var(--primary-light);border-radius:50%;margin:0 auto }

/* Week view */
.week-grid { display:grid;grid-template-columns:repeat(7,1fr);gap:4px }
.week-col { border:1px solid var(--border);border-radius:6px;overflow:hidden;min-height:200px }
.week-col-hdr { background:#f0f4f8;padding:6px;text-align:center;font-size:0.75rem;font-weight:700 }
.week-col-hdr.today-col { background:var(--primary);color:#fff }
.week-col-body { padding:4px;min-height:150px;max-height:300px;overflow-y:auto;overflow-x:hidden }
.week-col-body::-webkit-scrollbar { width:3px }
.week-col-body::-webkit-scrollbar-thumb { background:#c1c9d2;border-radius:2px }
.week-col-body::-webkit-scrollbar-track { background:transparent }
.week-col.drag-over { background:#e8f4fd!important;outline:2px dashed var(--primary-light) }

/* Day view */
.day-events { display:flex;flex-direction:column;gap:8px }
.day-event-card { border-left:4px solid var(--primary-light);background:#fff;border-radius:0 6px 6px 0;padding:10px 14px;box-shadow:0 1px 3px rgba(0,0,0,0.06) }
.day-event-card.silicone { border-left-color:#28a745 }
.day-event-card.overdue  { border-left-color:#dc3545 }

#btn-clear-overrides { display:none }

/* Validate modal */
.vm-next-info { background:#f0f9f4;border:1px solid #a7f3d0;border-radius:6px;padding:12px;margin-top:8px;font-size:0.85rem;color:#065f46 }

/* ── Agenda ───────────────────────────────────────────── */
.agenda-day {
  border-left: 3px solid var(--primary-light);
  padding-left: 16px;
  margin-bottom: 20px;
}

.agenda-day-header {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.agenda-entry {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.agenda-entry-type {
  font-weight: 800;
  font-size: 0.8rem;
  padding: 2px 8px;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  min-width: 36px;
  text-align: center;
}

.agenda-entry-info { flex: 1; }
.agenda-entry-site { font-weight: 600; }
.agenda-entry-duration { font-size: 0.78rem; color: var(--text-muted); }

/* ── Commandes Print Layout ───────────────────────────── */
.order-site-block {
  margin-bottom: 24px;
  break-inside: avoid;
}

.order-site-title {
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  font-weight: 700;
  font-size: 0.9rem;
}

.order-products-table {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.empty-state-sub { font-size: 0.84rem; margin-bottom: 16px; }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 2px;
}

.tab-btn {
  padding: 9px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Search/Filter Bar ────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  padding: 7px 11px 7px 32px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236c7a8d' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.84rem;
}

/* ── Progress bar ─────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-light);
  border-radius: 3px;
  transition: width 0.3s;
}

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-weight: 700; font-size: 1rem; color: var(--primary); }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px;
}

.modal-body { padding: 20px; }

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

/* ── Utility ──────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-muted { color: var(--text-muted); font-size: 0.82rem; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'Consolas', 'Courier New', monospace; font-size: 0.82rem; }
.w-full { width: 100%; }

/* ── Toast notification ───────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  background: #1a2332;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.25s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 340px;
}

.toast-item.success { border-left: 3px solid var(--success); }
.toast-item.error   { border-left: 3px solid var(--danger); }
.toast-item.warning { border-left: 3px solid var(--warning); }

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

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8d0dc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0aab8; }

/* ── User menu (avatar + menu déroulant) ─────────────────── */
.user-menu { position: relative; }

.user-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}
.user-menu-btn:hover { border-color: var(--primary-light); }
.user-menu-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }

.user-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 100;
  overflow: hidden;
}
.user-menu-dropdown.open { display: block; }

.user-menu-name {
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.84rem;
  color: var(--text);
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.user-menu-item:hover { background: var(--bg); }

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

.auth-body.login-page { background: #0303B8; }

.auth-wrap { display: flex; align-items: center; justify-content: center; gap: 48px; }
.auth-robot { width: 140px; height: auto; flex-shrink: 0; }
@media (max-width: 760px) { .auth-robot { display: none; } }

.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 32px; }
.login-page .auth-card { max-width: 380px; }

.auth-title { font-size: 1.3rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; text-align: center; }
.login-page .auth-title { font-size: 2rem; }

.auth-subtitle { font-size: 0.85rem; color: var(--text-muted); text-align: center; margin-bottom: 24px; }
.auth-card .form-group { margin-bottom: 16px; }
.login-page .auth-card .form-group { text-align: center; color: var(--primary); }
.auth-card label { display: block; font-size: 0.84rem; font-weight: 600; margin-bottom: 6px; }
.auth-card input { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 0.9rem; }
.auth-card input:focus { outline: none; border-color: var(--primary-light); }
.auth-card .form-hint { margin-top: 4px; }
.auth-error { display: none; margin-bottom: 16px; }
#login-btn { justify-content: center; }

/* ── Échéancier ───────────────────────────────────────── */
.phase-col { width:50px;text-align:center;font-size:0.75rem }
.phase-check { color:var(--primary);font-weight:800 }
.section-row td { background:#f0f4f8;font-weight:700;color:var(--primary);font-size:0.8rem;text-transform:uppercase;letter-spacing:0.04em }
.qty-badge { display:inline-block;min-width:22px;text-align:center;background:var(--primary-light);color:#fff;border-radius:3px;font-size:0.72rem;font-weight:700;padding:1px 4px }
.edit-mode .section-row td { background:#e8f4fd }
.edit-bar { display:none;gap:8px;align-items:center;margin-bottom:12px }
.edit-bar.visible { display:flex }
.edit-actions { display:none }
.edit-mode .edit-actions { display:inline-flex;gap:4px }
.add-section-row td { background:#f8fafc;text-align:center;padding:8px }

/* ── Site block (commandes maintenance / silicone) ──────── */
.site-block { border:1px solid var(--border); border-radius:8px; margin-bottom:20px; overflow:hidden; break-inside:avoid; }
.site-block-header {
  background: var(--primary); color:#fff;
  padding:10px 16px;
  display:flex; align-items:center; justify-content:space-between;
}
.site-block-header .type-badge {
  background:rgba(255,255,255,0.2); color:#fff;
  padding:2px 10px; border-radius:12px; font-size:0.8rem; font-weight:700;
}
.site-block table { margin:0; }
.site-block table thead th { background:#f6f8fb; }
.site-block tfoot td { font-weight:700; background:#f0f4f8; }

.silicone-page .site-block-header { background:#166534; }

/* ── Commandes Hygiène ────────────────────────────────── */
.hyg-section { background:#f6f8fb; padding:8px 12px; font-weight:700; font-size:0.78rem;
               text-transform:uppercase; letter-spacing:.05em; color:var(--primary);
               border-bottom:1px solid var(--border); }
.prod-qty { font-weight:700; color:var(--primary); }
.container-list { font-size:0.78rem; color:var(--text-muted); }

/* ── PRINT STYLES ─────────────────────────────────────── */
@media print {
  .sidebar, .top-bar, .btn, .filter-bar, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  body { font-size: 11px; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  table { font-size: 10px; }
  .order-site-block { break-inside: avoid; margin-bottom: 16px; }
  @page { margin: 1.5cm; }
}
