/* ═══════════════════════════════════════════════
   LAYOUT — Sidebar · Main · Header · Toolbar
═══════════════════════════════════════════════ */

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border-light);
}
.logo-row { display: flex; align-items: center; gap: 11px; }
.logo-img  { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.logo-fallback {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--teal-grad); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff; letter-spacing: -.5px;
}
.logo-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  letter-spacing: -.3px; line-height: 1.2;
}
.logo-sub {
  font-size: 10.5px; font-weight: 500; color: var(--text-3);
  letter-spacing: .05em; text-transform: uppercase; margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 1px;
  overflow-y: auto;
}
.nav-sec {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-3);
  padding: 10px 8px 5px; margin-top: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r);
  cursor: pointer; color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
  user-select: none;
}
.nav-item:hover  { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--teal-soft); color: var(--teal-text); }
.nav-item svg    { width: 16px; height: 16px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  font-size: 11px; font-weight: 600; color: var(--text-3);
  background: var(--bg-hover); padding: 1px 7px;
  border-radius: 99px; min-width: 22px; text-align: center;
}
.nav-item.active .nav-badge {
  background: var(--teal-border); color: var(--teal-text);
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 8px;
}
.footer-dot {
  width: 7px; height: 7px; background: var(--green);
  border-radius: 50%; flex-shrink: 0;
}
.footer-email {
  font-size: 11.5px; color: var(--text-2);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.theme-btn {
  width: 28px; height: 28px; border-radius: 8px;
  background: transparent; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: background .12s, color .12s; flex-shrink: 0;
}
.theme-btn:hover { background: var(--bg-hover); color: var(--text); }
.theme-btn svg   { width: 15px; height: 15px; }

/* ── Main content area ── */
.main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
}

/* Each page fills the main area */
.page-mount {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── Page header ── */
.page-header {
  padding: 22px 28px 18px;
  background: var(--bg-sidebar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 20px;
  flex-shrink: 0;
}
.page-title {
  font-size: 22px; font-weight: 800; color: var(--text);
  letter-spacing: -.6px; line-height: 1.2;
}
.page-sub {
  font-size: 12px; font-weight: 500; color: var(--text-3);
  margin-top: 3px; letter-spacing: .01em;
}

/* Header stats strip */
.hd-stats  { display: flex; gap: 20px; margin-left: auto; }
.stat-item { display: flex; flex-direction: column; align-items: flex-end; }
.stat-val  { font-size: 20px; font-weight: 700; line-height: 1; letter-spacing: -.5px; }
.stat-lbl  {
  font-size: 10.5px; font-weight: 600; color: var(--text-3);
  margin-top: 2px; letter-spacing: .02em; text-transform: uppercase;
}
.stat-item.g .stat-val { color: var(--green); }
.stat-item.a .stat-val { color: var(--amber); }
.stat-item.r .stat-val { color: var(--red); }
.stat-sep { width: 1px; background: var(--border); align-self: stretch; }

/* ── Toolbar ── */
.toolbar {
  padding: 12px 28px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg); flex-shrink: 0;
}

.search-wrap { position: relative; flex: 1; max-width: 300px; }
.search-wrap svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-3); pointer-events: none;
}
.search-input {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-family: inherit;
  font-size: 13.5px; font-weight: 500; padding: 8px 12px 8px 33px;
  outline: none; transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus {
  border-color: var(--teal-lo);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.chips { display: flex; gap: 6px; }
.chip {
  padding: 6px 13px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-2); font-family: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all .12s; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.chip:hover { color: var(--text); }
.chip.active { border-color: var(--teal-border); color: var(--teal-text); background: var(--teal-soft); }
.chip.cg     { border-color: var(--green-border); color: var(--green); background: var(--green-bg); }
.chip.ca     { border-color: var(--amber-border); color: var(--amber); background: var(--amber-bg); }
.chip.cr     { border-color: var(--red-border);   color: var(--red);   background: var(--red-bg); }

.sort-sel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text-2); font-family: inherit;
  font-size: 12.5px; font-weight: 500; padding: 7px 10px; outline: none;
  cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.sort-sel:focus { border-color: var(--teal-lo); }

.res-label { font-size: 12px; font-weight: 500; color: var(--text-3); white-space: nowrap; }

/* View toggle */
.view-toggle {
  display: flex; gap: 2px; background: var(--bg-hover);
  padding: 3px; border-radius: 8px; flex-shrink: 0;
}
.view-btn {
  width: 28px; height: 28px; border-radius: 6px; border: none;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); transition: all .12s;
}
.view-btn.active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-card); }
.view-btn svg    { width: 14px; height: 14px; }

/* ── Placeholder pages (Dispatch / Facturation stubs) ── */
.ph-page {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
.ph-icon {
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--teal-soft);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.ph-icon svg    { width: 30px; height: 30px; color: var(--teal-text); }
.ph-page h2     { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -.4px; }
.ph-page p      { font-size: 13px; font-weight: 500; color: var(--text-2); }
.ph-chip {
  margin-top: 6px; padding: 5px 14px; border-radius: 99px;
  border: 1px solid var(--border); font-size: 12px; font-weight: 600;
  color: var(--text-3); background: var(--bg-card);
}
