* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
  background: #f5f7fb;
  color: #17243e;
}
.app {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease;
}
.side {
  position: relative;
  background: #f5f7fb;
  color: #dce6f4;
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  margin: 0 0 14px;
  padding: 8px;
  color: #17243e;
  font-size: 17px;
  font-weight: 800;
}
.brand-mark {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #35bda7;
  color: #10233f;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
}
.brand-name {
  line-height: 1.15;
}
.brand-name .brand-immo {
  color: #35bda7;
}
.nav {
  display: grid;
  gap: 6px;
  padding: 12px 10px;
  background: #10233f;
  border-radius: 20px;
  box-shadow: 0 14px 30px #10233f28;
}
.nav button {
  border: 0;
  background: transparent;
  color: #afbdd1;
  padding: 13px 14px;
  border-radius: 10px;
  text-align: left;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.nav button:hover,
.nav button.on {
  background: #1b3557;
  color: #fff;
}
.nav button span {
  display: inline-block;
  width: 28px;
}
.profile {
  margin-top: auto;
  border: 1px solid #e3e8ef;
  background: #fff;
  color: #657288;
  padding: 15px 14px;
  border-radius: 14px;
  box-shadow: 0 6px 20px #10233f0d;
  font-size: 13px;
}
.profile strong {
  display: block;
  color: #17243e;
  font-size: 14px;
}
.collapse-menu {
  position: absolute;
  z-index: 5;
  top: 102px;
  right: 3px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #35bda7;
  color: #10233f;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px #10233f30;
  transition: transform 0.25s ease;
}
.collapse-menu:hover {
  background: #49ceb7;
}
.app.menu-collapsed {
  grid-template-columns: 92px 1fr;
}
.app.menu-collapsed .side {
  padding-inline: 10px;
}
.app.menu-collapsed .brand {
  padding: 6px;
  justify-content: center;
}
.app.menu-collapsed .brand-name {
  display: none;
}
.app.menu-collapsed .nav {
  padding-inline: 7px;
}
.app.menu-collapsed .nav button {
  padding-inline: 6px;
  text-align: center;
}
.app.menu-collapsed .nav button span {
  width: auto;
}
.app.menu-collapsed .nav button b,
.app.menu-collapsed .profile {
  display: none;
}
.app.menu-collapsed .collapse-menu {
  transform: rotate(180deg);
  right: -5px;
}
.main {
  padding: 28px 34px 60px;
  overflow: auto;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.top h1 {
  margin: 0;
  font-size: 26px;
}
.top p {
  margin: 6px 0 0;
  color: #77849a;
}
.primary {
  border: 0;
  background: #1b5cff;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px #1b5cff33;
}
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.card {
  background: #fff;
  border: 1px solid #e6eaf1;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 5px 20px #1f33530a;
}
.metric small {
  color: #788499;
  font-weight: 600;
}
.metric b {
  display: block;
  font-size: 28px;
  margin: 10px 0 5px;
}
.metric em {
  font-style: normal;
  color: #169c70;
  font-size: 12px;
  font-weight: 700;
}
.section {
  margin-top: 24px;
}
.sectionHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.sectionHead h2 {
  font-size: 18px;
  margin: 0;
}
.sectionHead a {
  color: #1b5cff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.twocol {
  display: grid;
  grid-template-columns: 1.55fr 0.8fr;
  gap: 18px;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a95a8;
  padding: 0 10px 12px;
}
.table td {
  padding: 15px 10px;
  border-top: 1px solid #edf0f5;
  font-size: 13px;
}
.client {
  font-weight: 750;
}
.muted {
  color: #7c899c;
}
.pill {
  padding: 6px 9px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}
.blue {
  color: #175cd3;
  background: #eaf1ff;
}
.amber {
  color: #a15c00;
  background: #fff2da;
}
.green {
  color: #087d57;
  background: #dcf8ed;
}
.gray {
  color: #687386;
  background: #edf0f4;
}
.red {
  color: #b42318;
  background: #fee4e2;
}
.money {
  font-weight: 800;
}
.progress {
  height: 7px;
  background: #e8edf4;
  border-radius: 10px;
  margin: 12px 0;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 68%;
  background: #36d2a2;
  border-radius: 10px;
}
.refbox {
  background: linear-gradient(145deg, #163252, #10233f);
  color: white;
}
.refbox p {
  color: #b9c8db;
  font-size: 13px;
  line-height: 1.5;
}
.link {
  display: flex;
  background: #ffffff12;
  border: 1px solid #ffffff24;
  border-radius: 9px;
  padding: 10px;
  font-size: 11px;
  margin: 14px 0;
  overflow: hidden;
}
.link span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.copy {
  margin-left: auto;
  color: #5be1b8;
  font-weight: 800;
  cursor: pointer;
}
.rules {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.rule {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.rule b {
  color: #36d2a2;
}
.network-summary {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.network-summary td {
  padding: 11px 0;
  border-top: 1px solid #edf0f5;
}
.network-summary td:first-child {
  color: #7c899c;
  font-size: 12px;
}
.network-summary td:last-child {
  text-align: right;
  font-weight: 800;
  color: #17243e;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
.formgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field {
  display: grid;
  gap: 7px;
}
.field label {
  font-size: 12px;
  color: #657288;
  font-weight: 700;
}
.field input,
.field select {
  border: 1px solid #dce2eb;
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  background: white;
}
.wide {
  grid-column: 1/-1;
}
.notice {
  background: #eef4ff;
  color: #24529d;
  border-radius: 11px;
  padding: 13px;
  font-size: 13px;
  margin-bottom: 18px;
}
.commission {
  background: #f0fbf7;
  border: 1px solid #caf1e4;
  border-radius: 12px;
  padding: 15px;
  color: #12684e;
}
.commission b {
  font-size: 22px;
}
.empty {
  padding: 30px;
  text-align: center;
  color: #7c899c;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e8efff;
  display: inline-grid;
  place-items: center;
  color: #1b5cff;
  font-weight: 800;
  margin-right: 8px;
}
.toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  background: #10233f;
  color: #fff;
  padding: 13px 18px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.filters {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}
.filters .field {
  min-width: 150px;
}
.secondary {
  border: 1px solid #d8e0ec;
  background: #fff;
  color: #24405f;
  padding: 11px 15px;
  border-radius: 10px;
  font-weight: 750;
  cursor: pointer;
}
.reportbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  background: #eef4ff;
  border: 1px solid #dce7fb;
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 18px;
}
.reportbar h3 {
  margin: 0 0 4px;
  font-size: 15px;
}
.reportbar p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}
.field textarea {
  border: 1px solid #dce2eb;
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  background: white;
  min-height: 100px;
  resize: vertical;
}
@media (max-width: 900px) {
  .app {
    grid-template-columns: 92px 1fr;
  }
  .side {
    padding: 22px 10px;
  }
  .nav button b,
  .profile {
    display: none;
  }
  .brand {
    margin: 0 0 28px;
    padding: 5px 4px;
    border-radius: 8px;
  }
  .brand-name {
    display: none;
  }
  .brand {
    justify-content: center;
  }
  .collapse-menu {
    display: none;
  }
  .nav button span {
    width: auto;
  }
  .nav button {
    text-align: center;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  .twocol {
    grid-template-columns: 1fr;
  }
  .main {
    padding: 24px 18px;
  }
}
@media (max-width: 560px) {
  .grid,
  .formgrid {
    grid-template-columns: 1fr;
  }
  .wide {
    grid-column: auto;
  }
  .top {
    align-items: flex-start;
    gap: 12px;
  }
  .top h1 {
    font-size: 21px;
  }
  .primary {
    padding: 10px;
  }
  .table th:nth-child(2),
  .table td:nth-child(2) {
    display: none;
  }
  .reportbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .filters {
    width: 100%;
  }
  .filters .field {
    flex: 1;
    min-width: 120px;
  }
}
.login-card{width:min(430px,100%);background:#fff;border:1px solid #e6eaf1;border-radius:20px;padding:30px;box-shadow:0 20px 60px #10233f18}
.login-card h1{margin:10px 0 5px}.login-card p{color:#77849a;margin:0 0 22px}
.login-brand{font-size:20px;font-weight:900;color:#10233f}.login-brand span{color:#35bda7}
.login-card .field{margin:12px 0}.login-card .primary{width:100%;margin-top:10px}

/* ===== Ajouts V1 (application fonctionnelle) ===== */

/* Liens du menu : mêmes styles que les boutons du prototype */
.nav a, .nav form button {
  display: block; width: 100%;
  border: 0; background: transparent; color: #afbdd1;
  padding: 13px 14px; border-radius: 10px; text-align: left;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.nav form { margin: 0; }
.nav a:hover, .nav a.on, .nav form button:hover { background: #1b3557; color: #fff; }
.nav a span, .nav form button span { display: inline-block; width: 28px; }
.nav .nav-sep { height: 1px; background: #ffffff1a; margin: 6px 8px; }
.app.menu-collapsed .nav a, .app.menu-collapsed .nav form button { padding-inline: 6px; text-align: center; }
.app.menu-collapsed .nav a span, .app.menu-collapsed .nav form button span { width: auto; }
.app.menu-collapsed .nav a b, .app.menu-collapsed .nav form button b { display: none; }
@media (max-width: 900px) {
  .nav a b, .nav form button b { display: none; }
  .nav a span, .nav form button span { width: auto; }
  .nav a, .nav form button { text-align: center; }
}
.side-footer { margin-top: 14px; font-size: 11px; color: #8a95a8; text-align: center; line-height: 1.7; }
.side-footer a { color: #8a95a8; }
.app.menu-collapsed .side-footer { display: none; }
@media (max-width: 900px) { .side-footer { display: none; } }
.main-footer { margin-top: 40px; font-size: 12px; color: #8a95a8; }
.main-footer a { color: #8a95a8; }

/* Boutons et liens */
a.primary, a.secondary, .btn-link { display: inline-block; text-decoration: none; }
.primary:disabled { opacity: .6; cursor: default; }
.small { padding: 7px 11px; font-size: 12px; border-radius: 8px; }
.danger { border: 1px solid #f3c1bc; background: #fff; color: #b42318; padding: 11px 15px; border-radius: 10px; font-weight: 750; cursor: pointer; }
.linkish { color: #1b5cff; font-weight: 700; text-decoration: none; }
.linkish:hover { text-decoration: underline; }
.inline-form { display: inline; margin: 0; }

/* Messages */
.notice.err { background: #fee4e2; color: #9b1c13; }
.notice.ok  { background: #dcf8ed; color: #0a6b4b; }
.notice.warn{ background: #fff2da; color: #8a4f00; }
.notice ul { margin: 6px 0 0 18px; padding: 0; }
.toast.err { background: #b42318; }

/* Formulaires */
.field input[type=file] { padding: 9px; }
.field .hint { font-size: 11px; color: #8a95a8; font-weight: 500; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #24405f; line-height: 1.45; }
.check input { margin-top: 3px; width: 17px; height: 17px; flex: 0 0 17px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #1b5cff33; border-color: #1b5cff; }

/* Pages de connexion */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card .muted-links { margin-top: 18px; font-size: 13px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.login-card .muted-links a { color: #1b5cff; font-weight: 600; text-decoration: none; }
.login-card .legal { margin: 18px 0 0; font-size: 11px; text-align: center; }
.login-card .legal a { color: #8a95a8; }
.login-card.wide-card { width: min(560px, 100%); }
.login-card .formgrid { gap: 0 14px; }
.login-card .formgrid .field { margin: 10px 0; }
@media (max-width: 560px) { .login-card .formgrid { grid-template-columns: 1fr; } }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.table td .sub { display: block; color: #7c899c; font-size: 12px; margin-top: 2px; }
.table tr.row-link { cursor: pointer; }
.table tr.row-link:hover td { background: #f8faff; }
.table .right, .table th.right { text-align: right; }
.empty-row td { text-align: center; color: #7c899c; padding: 30px 10px; }

/* Divers */
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 10px 0; border-top: 1px solid #edf0f5; font-size: 13px; vertical-align: top; }
.kv td:first-child { color: #7c899c; width: 42%; padding-right: 12px; }
.kv td:last-child { font-weight: 650; }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .progress { margin: 0; display: block; }
.bar-row b { text-align: right; }
.doc-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; padding: 10px 12px; background: #f5f7fb; border-radius: 10px; margin-top: 4px; }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; align-items: center; font-size: 13px; }
.stack { display: grid; gap: 18px; }
.legal-page { max-width: 820px; margin: 40px auto; padding: 0 20px; line-height: 1.6; }
.legal-page h1 { font-size: 26px; }
.legal-page h2 { font-size: 17px; margin-top: 26px; }
.todo { background: #fff2da; color: #8a4f00; padding: 2px 6px; border-radius: 6px; font-weight: 700; }

/* Relevé imprimable */
.releve { max-width: 860px; margin: 30px auto; background: #fff; padding: 34px; border: 1px solid #e6eaf1; border-radius: 16px; }
.releve h1 { font-size: 22px; margin: 6px 0 2px; }
.releve .totaux { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.releve .totaux div { background: #f5f7fb; border-radius: 10px; padding: 12px; font-size: 12px; color: #657288; }
.releve .totaux b { display: block; font-size: 18px; color: #17243e; margin-top: 4px; }
.releve-actions { max-width: 860px; margin: 20px auto 0; display: flex; gap: 10px; justify-content: flex-end; padding: 0 10px; }
@media print {
  body { background: #fff; }
  .releve-actions { display: none; }
  .releve { border: 0; margin: 0; padding: 0; max-width: none; }
}
@media (max-width: 560px) { .releve .totaux { grid-template-columns: 1fr 1fr; } .releve { padding: 20px; } .bar-row { grid-template-columns: 110px 1fr 34px; } }

/* Empêche les tableaux larges de déborder sur mobile (ils défilent dans leur carte) */
.main, .grid > *, .twocol > *, .stack > * { min-width: 0; }
