:root {
  --ink: #17243d;
  --muted: #71809a;
  --primary: #2463eb;
  --sidebar: #101c36;
  --sidebar-soft: #1a2b50;
  --surface: #f4f7fb;
}
* {
  box-sizing: border-box;
}
body {
  color: var(--ink);
  background: var(--surface);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 0.93rem;
}
.app-shell {
  min-height: 100vh;
}
#page-runtime {
  min-width: 0;
  width: 100%;
}
.sidebar {
  background: linear-gradient(180deg, #111e39 0%, #0c1830 100%);
  color: #d7e1f5;
  display: flex;
  flex-direction: column;
  width: 272px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  padding: 24px 14px 15px;
  transition: transform 0.2s ease;
  overflow-y: auto;
}
.brand {
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.7px;
  padding: 0 12px 26px;
}
.sidebar .brand {
  justify-content: center;
  padding: 0 4px 18px;
}
.brand-logo {
  display: block;
  width: 100%;
  height: 112px;
  object-fit: contain;
  object-position: center;
}
.login-card .brand {
  justify-content: center;
  padding: 0;
}
.login-card .brand-logo {
  width: 230px;
  height: 145px;
}
.brand > span:last-child span {
  color: #45d7b4;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #2a6df4;
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  box-shadow: 0 5px 15px #061b4c;
}
.nav-label {
  color: #7184a8;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 16px 12px 7px;
}
.nav-link {
  color: #c0cce0;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  margin: 2px 0;
  text-decoration: none;
  font-weight: 500;
}
.nav-link i {
  font-size: 1.06rem;
  width: 18px;
}
.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.nav-link.active {
  color: #fff;
  background: #2867ed;
  box-shadow: 0 8px 15px rgba(20, 67, 165, 0.35);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}
.sidebar-user strong,
.sidebar-user small {
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.sidebar-user small {
  color: #8ca0c2;
  font-size: 0.75rem;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #3375ef;
  font-weight: 700;
}
.main-content {
  width: auto;
  margin-left: 272px;
  padding: 0 34px 44px;
  max-width: none;
}
.topbar {
  min-height: 106px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.topbar h1 {
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  margin: 2px 0 0;
}
.eyebrow {
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.topbar-date {
  color: var(--muted);
  background: white;
  padding: 9px 12px;
  border: 1px solid #e8edf5;
  border-radius: 8px;
  font-size: 0.84rem;
}
.welcome-card {
  color: #fff;
  min-height: 175px;
  padding: 28px 32px;
  background: linear-gradient(115deg, #1d4ed8, #2469ed 64%, #48a4ff);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 15px 30px #2463eb33;
}
.welcome-card:after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  border: 40px solid #ffffff17;
  border-radius: 50%;
  right: -90px;
  top: -130px;
}
.welcome-card h2 {
  font-size: 1.6rem;
  font-weight: 750;
  margin: 0 0 4px;
}
.welcome-card p {
  opacity: 0.82;
  margin: 0;
}
.welcome-card > i {
  font-size: 4.5rem;
  opacity: 0.2;
  z-index: 1;
}
.metric-card,
.report-stat {
  background: #fff;
  border-radius: 13px;
  min-height: 125px;
  padding: 20px;
  display: flex;
  gap: 14px;
  box-shadow: 0 3px 12px #19274a0b;
  border: 1px solid #e8edf5;
}
.metric-icon {
  flex: 0 0 auto;
  border-radius: 11px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}
.metric-card small,
.report-stat small {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
}
.metric-card strong,
.report-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 1.22rem;
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.metric-card a {
  font-size: 0.75rem;
  text-decoration: none;
  display: block;
  margin-top: 7px;
}
.report-stat {
  display: block;
  min-height: 110px;
}
.report-stat strong {
  font-size: 1.42rem;
  margin-top: 10px;
}
.currency-total {
  font-size: 0.88rem !important;
  line-height: 1.45;
  white-space: normal !important;
}
.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  gap: 14px;
}
.card {
  border-radius: 12px;
}
.card-header {
  border-radius: 12px 12px 0 0 !important;
}
.table > thead > tr > th {
  background: #f8faff;
  color: #72809a;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 13px 20px;
  border-bottom: 1px solid #e8edf5;
  white-space: nowrap;
}
.table > tbody > tr > td {
  padding: 14px 20px;
  border-color: #edf0f5;
}
.table-hover tbody tr:hover > * {
  background: #f7faff;
}
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 42px !important;
}
.status,
.movement,
.stock-pill {
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 9px;
  display: inline-block;
}
.status.paid,
.movement.entree,
.movement.versement {
  color: #11875d;
  background: #e7f7f0;
}
.status.draft {
  color: #9a6b00;
  background: #fff7df;
}
.movement.sortie,
.movement.retrait {
  color: #bf3d45;
  background: #fff0f0;
}
.stock-pill {
  color: #18704f;
  background: #e7f7f0;
}
.stock-pill.low {
  background: #fff0ed;
  color: #cb4d39;
}
.form-control,
.form-select {
  border-color: #dce3ed;
  min-height: 40px;
}
.form-control:focus,
.form-select:focus {
  border-color: #8eb0fa;
  box-shadow: 0 0 0 0.2rem #2463eb18;
}
.form-label {
  color: #53627a;
  font-size: 0.8rem;
  font-weight: 650;
  margin-bottom: 5px;
}
.btn {
  font-weight: 600;
  border-radius: 7px;
}
.btn-primary {
  background: #2463eb;
  border-color: #2463eb;
}
.btn-primary:hover {
  background: #1855db;
  border-color: #1855db;
}
/* Modales : surface moderne, lisible et commune à tous les formulaires. */
.modal-backdrop.show {
  opacity: 0.48;
  backdrop-filter: blur(3px);
}
.modal.fade .modal-dialog {
  transform: translateY(-22px) scale(0.98);
  transition: transform 0.24s ease-out;
}
.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
}
.modal-content {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 20px;
  box-shadow: 0 24px 65px rgba(14, 30, 63, 0.28);
  background: #fff;
}
.modal-header {
  align-items: flex-start;
  padding: 22px 24px 19px;
  border-bottom: 1px solid #e9eef6;
  background: linear-gradient(135deg, #f8fbff, #eef5ff);
}
.modal-header .modal-title {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.modal-header small {
  display: block;
  margin-top: 4px;
}
.modal-header .btn-close {
  width: 2rem;
  height: 2rem;
  margin: -4px -5px 0 10px;
  border-radius: 50%;
  background-color: #e8effa;
  opacity: 0.7;
  transition:
    background-color 0.18s ease,
    opacity 0.18s ease;
}
.modal-header .btn-close:hover {
  background-color: #d9e7fb;
  opacity: 1;
}
.modal-body {
  max-height: min(68vh, 670px);
  padding: 24px;
  overflow-y: auto;
}
.modal-body .form-label {
  margin-bottom: 6px;
  color: #455775;
}
.modal-body .form-control,
.modal-body .form-select {
  border-color: #d9e2ef;
  background-color: #fbfcff;
}
.modal-body .form-control:focus,
.modal-body .form-select:focus {
  background-color: #fff;
}
.modal-footer {
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid #e9eef6;
  background: #fbfcff;
}
.modal-footer .btn-primary {
  min-width: 145px;
  padding: 0.62rem 1.05rem;
  box-shadow: 0 7px 15px rgba(36, 99, 235, 0.22);
}
.form-card {
  max-width: 900px;
}
.section-title {
  display: flex;
  gap: 13px;
  align-items: center;
}
.section-title h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}
.section-title p {
  color: var(--muted);
  margin: 3px 0 0;
}
.report-filters .card-body {
  padding: 15px 20px;
}
.report-filters .form-label {
  display: block;
}
.report-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 25px 0 16px;
}
.report-heading h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2px 0 0;
}
.invoice-lines {
  border: 1px solid #e5eaf2;
  border-radius: 9px;
  overflow: visible;
}
.line-head,
.invoice-line {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 85px 125px 105px 38px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}
.line-head {
  background: #f8faff;
  color: #71809a;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}
.invoice-line {
  border-top: 1px solid #edf0f5;
}
.line-total {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}
.invoice-summary {
  padding-top: 25px;
}
.invoice-summary span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  padding: 5px 0;
}
.invoice-summary strong {
  color: var(--ink);
}
.invoice-summary .grand-total {
  border-top: 1px solid #dfe5ee;
  margin-top: 5px;
  padding-top: 11px;
  font-size: 1.05rem;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 5% 5%, #dfeaff, transparent 30%), #f1f5fb;
  padding: 18px;
}
.login-card {
  width: 100%;
  max-width: 450px;
  border-radius: 17px;
}
.login-card .brand {
  color: var(--ink);
  padding: 0;
}
.login-card .brand > span:last-child span {
  color: #1eb28d;
}
@media (max-width: 575px) {
  .modal-dialog {
    margin: 0.75rem;
  }
  .modal-content {
    border-radius: 17px;
  }
  .modal-header,
  .modal-body {
    padding: 20px;
  }
  .modal-footer {
    padding: 14px 20px 18px;
  }
  .modal-footer .btn-primary {
    width: 100%;
  }
}
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 18px #0004;
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-content {
    width: 100%;
    margin-left: 0;
    padding: 0 18px 35px;
  }
  .topbar {
    min-height: 84px;
  }
  .topbar-date {
    display: none;
  }
}
@media (max-width: 700px) {
  .page-actions,
  .report-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .welcome-card {
    padding: 24px;
    min-height: 150px;
  }
  .welcome-card > i {
    display: none;
  }
  .line-head {
    display: none;
  }
  .invoice-line {
    grid-template-columns: 1fr 74px 100px 30px;
  }
  .invoice-line output {
    display: none;
  }
  .invoice-line .remove-line {
    grid-column: 4;
  }
  .table > thead > tr > th,
  .table > tbody > tr > td {
    padding-left: 13px;
    padding-right: 13px;
  }
  .metric-card strong,
  .report-stat strong {
    font-size: 1.08rem;
  }
  .topbar h1 {
    font-size: 1.3rem;
  }
}

.invoice-lines[data-kind="service"] .line-head,
.invoice-lines[data-kind="service"] .service-line {
  grid-template-columns:
    minmax(140px, 1fr) minmax(120px, 0.85fr)
    65px 95px 105px 110px 38px;
}
.service-account-picker,
.movement-account-picker,
.product-picker {
  position: relative;
  min-width: 0;
}
.service-account-picker .service-account,
.movement-account-picker .account-select,
.product-picker .product-choice,
.product-picker .supply-product-choice {
  display: none;
}
.service-account-trigger,
.movement-account-trigger,
.product-trigger {
  width: 100%;
  min-height: 38px;
  padding: 0.375rem 2.25rem 0.375rem 0.75rem;
  color: #24324a;
  text-align: left;
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 16 16'%3e%3cpath d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat right 0.75rem center / 16px 12px;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
}
.service-account-picker.is-invalid .service-account-trigger {
  border-color: #dc3545;
}
.product-picker.is-invalid .product-trigger {
  border-color: #dc3545;
}
.service-account-dropdown,
.movement-account-dropdown,
.product-dropdown {
  position: absolute;
  z-index: 1060;
  top: calc(100% + 4px);
  left: 0;
  display: none;
  width: 300px;
  max-width: calc(100vw - 32px);
  padding: 8px;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  box-shadow: 0 8px 20px rgba(29, 45, 75, 0.16);
}
.service-account-picker.is-open .service-account-dropdown,
.movement-account-picker.is-open .movement-account-dropdown,
.product-picker.is-open .product-dropdown {
  display: block;
}
.service-account-options,
.movement-account-options,
.product-options {
  max-height: 220px;
  margin-top: 7px;
  overflow-y: auto;
}
.service-account-option,
.movement-account-option,
.product-option {
  display: block;
  width: 100%;
  padding: 7px 9px;
  color: #24324a;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
}
.service-account-option:hover,
.service-account-option:focus,
.movement-account-option:hover,
.movement-account-option:focus,
.product-option:hover,
.product-option:focus {
  background: #eef4ff;
  outline: 0;
}
.service-account-empty,
.movement-account-empty,
.product-empty {
  margin: 8px;
  color: #71809a;
  font-size: 0.85rem;
  text-align: center;
}
.service-account-picker .form-control,
.movement-account-picker .form-control,
.product-picker .form-control {
  min-width: 0;
}

.table-pagination {
  background: #fff;
}
.table-search {
  background: #fff;
}
.table-search .form-control {
  max-width: 380px;
}
.table-pagination .pagination {
  justify-content: flex-end;
}
@media (max-width: 700px) {
  .invoice-lines[data-kind="service"] .service-line {
    grid-template-columns: 1fr 1fr;
  }
  .invoice-lines[data-kind="service"] .service-line .remove-line {
    grid-column: 2;
  }
  .table-pagination .pagination {
    justify-content: flex-start;
  }
}
