/* JobsitePro Addon SST — Design System
   Références : SiteDocs (terrain, cartes, pastilles, mobile-first)
                Dashpivot (sidebar sombre, registres, topbar, densité)
   Tous les anciens noms de classes restent valides. */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  /* Surfaces */
  --canvas: #f4f6fa;
  --bg-main: #f4f6fa;
  --bg-white: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;

  /* Sidebar (Dashpivot) */
  --bg-sidebar: #0f1826;
  --bg-sidebar-2: #16202f;
  --bg-sidebar-hover: #1c2838;
  --bg-sidebar-active: #1d4ed8;

  /* Texte */
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-white: #ffffff;

  /* Marque */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-ring: rgba(37, 99, 235, 0.16);

  /* Sécurité (SiteDocs) */
  --accent: #f97316;
  --accent-soft: #fff7ed;
  --success: #16a34a;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0ea5e9;

  --sst-green: #16a34a;
  --sst-orange: #f97316;

  /* Bordures / ombres */
  --border: #e2e8f0;
  --border-light: #eef2f7;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.16);

  --sidebar-w: 256px;
  --topbar-h: 64px;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--text-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.015em; margin: 0 0 0.5em; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.5em; }
p { line-height: 1.6; margin: 0 0 0.75em; }
.muted { color: var(--text-secondary); }
.small { font-size: 12.5px; color: var(--text-secondary); }

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  padding: 0 0 8px;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  color: var(--text-white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-logo .logo-mark {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-mark svg { width: 20px; height: 20px; stroke: #fff; fill: none; }
.sidebar-logo .logo-mark-img {
  width: 38px; height: 38px; border-radius: 10px;
  object-fit: cover; flex-shrink: 0;
  background: #fff;
  display: block;
}
.sidebar-logo .logo-text { font-weight: 700; font-size: 14.5px; line-height: 1.25; letter-spacing: -0.01em; }
.sidebar-logo .logo-text span {
  display: block; font-weight: 500; font-size: 11px;
  color: rgba(255, 255, 255, 0.5); letter-spacing: 0.02em;
}

.sidebar-menu { flex: 1; overflow-y: auto; padding: 14px 10px; }
.sidebar-section {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: rgba(255, 255, 255, 0.34);
  padding: 14px 10px 7px;
}
.sidebar-section:first-child { padding-top: 2px; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.68);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.sidebar-item:hover { background: var(--bg-sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.28), rgba(37, 99, 235, 0.1));
  color: #fff;
  font-weight: 600;
}
.sidebar-item.active::before {
  content: "";
  position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: #60a5fa;
}
.sidebar-item svg {
  width: 18px; height: 18px; opacity: 0.75; flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.sidebar-item.active svg, .sidebar-item:hover svg { opacity: 1; }
.sidebar-item .nav-count {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: rgba(255, 255, 255, 0.12); color: #fff;
  padding: 1px 7px; border-radius: 999px;
}
.sidebar-item .nav-count.alert { background: var(--danger); }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  margin: 0 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}
.sidebar-user .avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #60a5fa); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px; flex-shrink: 0;
}
.sidebar-user .user-name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user .user-role { color: rgba(255, 255, 255, 0.5); font-size: 11px; }
.sidebar-user .logout-btn {
  margin-left: auto; background: none; border: none; color: rgba(255, 255, 255, 0.5);
  cursor: pointer; padding: 6px; border-radius: 6px;
}
.sidebar-user .logout-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.sidebar-user .logout-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ========== LAYOUT ========== */
.app-shell { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -0.015em; }
.topbar .crumb { font-size: 11.5px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-search { position: relative; width: 260px; }
.topbar-search input {
  min-height: 38px; padding: 8px 12px 8px 34px;
  background: var(--surface-3); border-color: transparent; font-size: 13px;
}
.topbar-search input:focus { background: #fff; }
.topbar-search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; stroke: var(--text-muted); fill: none; stroke-width: 2;
  pointer-events: none;
}
@media (max-width: 1100px) { .topbar-search { display: none; } }

.main-content { padding: 24px; max-width: 1280px; }

/* En-tête de page (Dashpivot) */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-header .page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.page-header .page-sub { font-size: 13px; color: var(--text-secondary); margin: 4px 0 0; }

.section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border);
  min-height: 40px; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  text-decoration: none; color: var(--text-primary); background: var(--bg-white);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-outline { background: #fff; color: var(--primary); border-color: #bfdbfe; }
.btn-outline:hover { background: var(--primary-soft); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(0.94); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }

.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { filter: brightness(0.95); }

.btn-ghost { background: #fff; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

.btn-sm { padding: 5px 11px; font-size: 12.5px; min-height: 32px; border-radius: 7px; }
.btn-lg { padding: 13px 22px; font-size: 15px; min-height: 50px; border-radius: var(--radius); }
.btn-block { width: 100%; }

/* ========== CARDS ========== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: -20px -20px 16px; padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
}
.card-head h3 { margin: 0; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* Tuiles KPI */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card .stat-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-card .stat-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.stat-card .stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.stat-card .stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-card .stat-icon.yellow { background: var(--warning-soft); color: #b45309; }
.stat-card .stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-card .stat-icon.orange { background: var(--accent-soft); color: var(--accent); }
.stat-card .stat-value { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 5px; font-weight: 500; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ========== TABLES (registres Dashpivot) ========== */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th {
  background: var(--surface-2);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding: 11px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
  white-space: nowrap;
}
td {
  padding: 13px 16px; font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface-2); }
tr.clickable { cursor: pointer; }

/* Barre de filtres */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.filter-bar input, .filter-bar select { min-height: 38px; max-width: 220px; font-size: 13px; }
.filter-bar .spacer { flex: 1; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: none; background: transparent; font-family: inherit;
  font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
  padding: 6px 13px; border-radius: 7px; cursor: pointer; min-height: 32px;
}
.seg button.active { background: #fff; color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ========== BADGES / PASTILLES ========== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.85; flex-shrink: 0;
}
.badge.no-dot::before { display: none; }
.badge-signed, .badge.ok { background: var(--success-soft); color: #15803d; border-color: #bbf7d0; }
.badge-pending, .badge.warn { background: var(--warning-soft); color: #b45309; border-color: #fde68a; }
.badge-overdue, .badge.err { background: var(--danger-soft); color: #b91c1c; border-color: #fecaca; }
.badge-neutral, .badge.neutral { background: var(--surface-3); color: #475569; border-color: var(--border); }
.badge-recurring, .badge.info { background: var(--primary-soft); color: #1d4ed8; border-color: #bfdbfe; }
.badge-accent { background: var(--accent-soft); color: #c2410c; border-color: #fed7aa; }

/* ========== PROGRESS ========== */
.progress-bar {
  width: 90px; height: 7px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block; vertical-align: middle;
}
.progress-bar-fill { height: 100%; border-radius: 999px; transition: width 0.35s ease; }
.progress-ok .progress-bar-fill { background: var(--success); }
.progress-mid .progress-bar-fill { background: var(--warning); }
.progress-low .progress-bar-fill { background: var(--danger); }

.progress { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--success); border-radius: 999px; transition: width .35s ease; }

/* Anneau de progression (SiteDocs) */
.ring {
  --pct: 0;
  --ring-color: var(--success);
  width: 84px; height: 84px; border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--surface-3) 0);
  display: grid; place-items: center; flex-shrink: 0;
}
.ring::after {
  content: attr(data-label);
  width: 66px; height: 66px; border-radius: 50%;
  background: #fff; display: grid; place-items: center;
  font-size: 16px; font-weight: 800; color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ========== FORMS ========== */
label {
  display: block;
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 15px 0 6px;
}
input, select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 14px; font-family: inherit;
  width: 100%; background: #fff; color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s, background .15s;
  min-height: 42px;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-ring);
}
textarea { min-height: 96px; resize: vertical; }
.checkbox-row {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 12px 0; text-transform: none; font-weight: 400; font-size: 14px;
  color: var(--text-primary); letter-spacing: 0;
}
.checkbox-row input { width: 18px; height: 18px; min-height: 18px; margin-top: 2px; flex: none; accent-color: var(--primary); }

/* ========== TABS ========== */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tabs button, .tab {
  padding: 11px 16px;
  font-size: 13.5px; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: none; background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  min-height: 44px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tabs button:hover, .tab:hover { color: var(--text-primary); }
.tabs button.active, .tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp .18s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 540px; max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 8px;
}
.modal .close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.modal .close:hover { color: var(--text-primary); background: var(--surface-3); }

/* ========== AUTH ========== */
.auth-wrap {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(1000px 500px at 50% -10%, #e8eefc 0%, var(--canvas) 60%);
}
.auth-card {
  width: 100%; max-width: 430px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
.auth-logo .mark {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.auth-logo .mark svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 2; }
.auth-logo-img {
  width: 62px; height: 62px; border-radius: 16px;
  object-fit: cover; box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  background: #fff; flex-shrink: 0; display: block;
}
.auth-logo .title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.auth-logo .sub { font-size: 12.5px; color: var(--text-secondary); }

/* Language switcher */
.lang-switcher {
  display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff;
}
.lang-switcher button {
  padding: 6px 11px; font-size: 12px; font-weight: 700; border: none; background: transparent;
  cursor: pointer; color: var(--text-secondary); font-family: inherit; line-height: 1;
}
.lang-switcher button:hover { background: var(--surface-3); }
.lang-switcher button.active { background: var(--primary); color: #fff; }
.lang-auth { position: absolute; top: 16px; right: 16px; z-index: 10; }
.mobile-header .lang-switcher { margin-right: 4px; }

.bell-btn {
  position: relative; background: #fff; border: 1px solid var(--border);
  border-radius: 9px; width: 38px; height: 38px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text-secondary);
}
.bell-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.bell-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.bell-btn .dot {
  position: absolute; top: -3px; right: -3px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

/* PWA install */
.install-overlay {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(15, 23, 42, 0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(3px);
}
.install-card {
  background: #fff; border-radius: 18px; padding: 28px 22px;
  width: 100%; max-width: 400px; text-align: center;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.install-logo {
  width: 88px; height: 88px; border-radius: 22px;
  object-fit: cover; margin: 0 auto 14px;
  box-shadow: var(--shadow-md); border: 1px solid var(--border); display: block;
}
.install-steps { margin: 0; padding-left: 1.25rem; font-size: 14px; line-height: 1.65; }
.install-steps li { margin-bottom: 6px; }
.ios-share { display: inline-flex; vertical-align: middle; margin-left: 4px; }
.install-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 45;
}
.install-banner img { border-radius: 9px; flex-shrink: 0; }

/* ========== FEED ========== */
.feed { display: flex; flex-direction: column; }
.feed .item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
}
.feed .item:last-child { border-bottom: none; }
.feed .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.feed .dot.green { background: var(--success); }
.feed .dot.orange { background: var(--accent); }
.feed .dot.blue { background: var(--primary); }

/* État vide */
.empty {
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius-lg); padding: 40px 24px; text-align: center;
  color: var(--text-secondary);
}
.empty .empty-icon {
  width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 12px;
  background: var(--surface-3); display: grid; place-items: center; font-size: 22px;
}

/* ========== UTILS ========== */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 12px; }
.mt-2 { margin-top: 20px; }
.mb { margin-bottom: 16px; }
.mb-2 { margin-bottom: 24px; }
.hidden { display: none !important; }
.center { text-align: center; }
.chip-btns { display: flex; gap: 6px; flex-wrap: wrap; }

.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 300px; }
.toolbar .search-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: var(--text-muted); fill: none; stroke-width: 2; pointer-events: none;
}
.toolbar .search-wrap input { padding-left: 36px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff;
  padding: 12px 18px; border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 300; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; font-size: 13.5px; font-weight: 600;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-secondary); padding: 34px 0; justify-content: center;
}

.doc-row {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 20px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s;
}
.doc-row:hover { box-shadow: var(--shadow-md); }
.doc-row .doc-meta { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }
.doc-status {
  min-width: 92px; text-align: center; padding: 10px 12px;
  border-radius: 12px; font-weight: 700; font-size: 13px; line-height: 1.25;
  flex-shrink: 0;
}
.doc-status small { font-weight: 600; font-size: 11px; opacity: 0.85; }
.doc-status.ok { background: var(--success-soft); color: #15803d; border: 1px solid #bbf7d0; }
.doc-status.wait { background: var(--warning-soft); color: #b45309; border: 1px solid #fde68a; }
.doc-status .v-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--success); color: #fff; font-size: 14px; margin-bottom: 2px;
}
.doc-status.wait .v-check { background: var(--warning); color: #fff; }

.sig-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sig-pill {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); font-family: inherit;
}
button.sig-pill { cursor: pointer; }
.sig-pill.ok { background: var(--success-soft); color: #15803d; border-color: #bbf7d0; }
button.sig-pill.ok:hover { background: #d1fae5; }
.sig-pill.wait { background: var(--surface-2); color: var(--text-secondary); }

/* Tree / file manager */
.tree-project {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-bottom: 12px; box-shadow: var(--shadow-sm); overflow: hidden;
}
.tree-project-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border-light);
}
.tree-doc {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 18px 11px 36px; border-bottom: 1px solid var(--border-light);
}
.tree-doc:last-child { border-bottom: none; }
.tree-doc:hover { background: var(--surface-2); }
.tree-actions { padding: 10px 18px; border-top: 1px solid var(--border-light); background: var(--surface-2); }

/* Matrice de signatures */
.sig-cell-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 280px; text-align: left;
  padding: 8px 10px; border-radius: 11px; cursor: pointer;
  background: var(--success-soft); border: 1px solid #bbf7d0; color: #15803d;
  transition: box-shadow .15s, transform .15s;
}
.sig-cell-btn:hover { box-shadow: 0 4px 12px rgba(22, 163, 74, 0.18); transform: translateY(-1px); }
.sig-cell-check {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--success); color: #fff; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sig-thumb {
  width: 72px; height: 36px; object-fit: contain; background: #fff;
  border-radius: 6px; border: 1px solid #bbf7d0; flex-shrink: 0;
}
.sig-thumb-ph {
  width: 36px; height: 36px; border-radius: 6px; background: #fff;
  border: 1px solid #bbf7d0; display: inline-flex; align-items: center;
  justify-content: center; color: var(--success); font-weight: 700;
}
.sig-cell-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sig-cell-meta strong { font-size: 13px; }
.sig-cell-meta small { font-size: 11px; opacity: 0.85; }
.sig-cell-link { font-size: 11px; font-weight: 700; color: var(--primary); margin-top: 2px; }
.sig-modal-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--success-soft); color: #15803d; border: 1px solid #bbf7d0;
}
.sig-modal-v {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--success); color: #fff; font-size: 20px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Signature canvas */
.sig-canvas-wrap {
  background: #fff; border: 2px dashed var(--border); border-radius: var(--radius);
  overflow: hidden; touch-action: none;
}
canvas.sig { display: block; width: 100%; height: 220px; background: #fff; touch-action: none; }

/* PDF viewer */
.pdf-viewer {
  background: #334155; border-radius: var(--radius);
  overflow-y: auto; max-height: 60vh; padding: 10px;
}
.pdf-viewer canvas { display: block; margin: 0 auto 10px; max-width: 100%; box-shadow: 0 4px 14px rgba(0,0,0,0.35); border-radius: 4px; }

/* ========== MOBILE EMPLOYÉ (SiteDocs) ========== */
.mobile-header {
  background: var(--bg-sidebar); color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 13px 16px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40;
  padding-top: calc(13px + env(safe-area-inset-top));
}
.mobile-header .brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 9px; color: #fff; }
.mobile-header .brand a { color: rgba(255,255,255,0.8); }
.mobile-header .btn-ghost {
  background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.16); color: #fff;
}
.mobile-header .btn-ghost:hover { background: rgba(255,255,255,0.18); color: #fff; }
.mobile-header .bell-btn {
  background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.16); color: #fff;
}
.mobile-header .lang-switcher { border-color: rgba(255,255,255,0.2); background: transparent; }
.mobile-header .lang-switcher button { color: rgba(255,255,255,0.75); }
.mobile-header .lang-switcher button.active { background: var(--primary); color: #fff; }

.mobile-wrap {
  max-width: 520px; margin: 0 auto; padding: 16px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* Carte résumé employé */
.emp-hero {
  background: linear-gradient(135deg, #16202f, #223349);
  color: #fff; border-radius: var(--radius-lg);
  padding: 18px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-md);
}
.emp-hero .hero-label { font-size: 12px; color: rgba(255,255,255,0.65); font-weight: 600; letter-spacing: 0.03em; }
.emp-hero .hero-value { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.emp-hero .hero-sub { font-size: 12.5px; color: rgba(255,255,255,0.7); margin-top: 4px; }
.emp-hero .ring::after { background: #16202f; color: #fff; }

.doc-group { margin-bottom: 22px; }
.doc-group .site-name {
  font-weight: 700; font-size: 13px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 7px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.doc-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 16px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 9px; cursor: pointer;
  min-height: 64px; box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--warning);
  transition: box-shadow .15s, transform .12s;
}
.doc-item:hover, .doc-item:active { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.doc-item.signed {
  cursor: default; border-left-color: var(--success); background: #fbfefc;
}
.doc-item .doc-title { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.doc-item .btn { min-height: 42px; }

/* Barre de navigation basse (PWA) */
.mobile-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: saturate(180%) blur(10px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 9px 4px 8px; text-decoration: none;
  color: var(--text-muted); font-size: 11px; font-weight: 600; min-height: 60px;
}
.mobile-nav a:hover { text-decoration: none; }
.mobile-nav a.active { color: var(--primary); }
.mobile-nav a .nav-ico { font-size: 19px; line-height: 1; }
.mobile-nav a.danger.active { color: var(--accent); }

/* Bouton action pleine largeur (terrain) */
.action-tile {
  display: flex; align-items: center; gap: 13px;
  width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 15px 16px; box-shadow: var(--shadow-sm); cursor: pointer;
  font-family: inherit; color: var(--text-primary); text-decoration: none;
  min-height: 66px;
}
.action-tile:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.action-tile .tile-ico {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 20px;
  background: var(--accent-soft); color: var(--accent);
}
.action-tile .tile-ico.blue { background: var(--primary-soft); color: var(--primary); }
.action-tile strong { display: block; font-size: 14.5px; font-weight: 700; }
.action-tile small { color: var(--text-secondary); font-size: 12.5px; }

/* Mobile sidebar collapse */
.sidebar-toggle {
  display: none; background: #fff; border: 1px solid var(--border);
  border-radius: 9px; width: 38px; height: 38px; cursor: pointer;
  align-items: center; justify-content: center;
}
.sidebar-toggle svg { width: 18px; height: 18px; stroke: var(--text-secondary); fill: none; stroke-width: 2; }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .app-shell { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .main-content { padding: 16px; }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.45); z-index: 99;
  }
  .sidebar-backdrop.show { display: block; }
  .topbar { padding: 0 16px; }
}
