:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --panel: rgba(23, 28, 36, 0.85);
  --panel-strong: rgba(27, 34, 44, 0.95);
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --teal: #10b981;
  --teal-dark: #059669;
  --shadow: rgba(0, 0, 0, 0.4);
  --ribbon-bg: #111827;
  --ribbon-pane: rgba(17, 24, 39, 0.85);
  --ribbon-edge: rgba(255, 255, 255, 0.1);
  --ribbon-tab: rgba(255, 255, 255, 0.05);
  --ribbon-tab-active: rgba(59, 130, 246, 0.2);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 50% -20%, #1e293b 0%, var(--bg) 90%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
  min-height: 100vh;
}

.is-invalid {
  border-color: #ff4d4d !important;
  background-color: rgba(255, 77, 77, 0.1) !important;
  box-shadow: 0 0 0 2px rgba(255, 77, 77, 0.2) !important;
}

.page {
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 420px);
  align-items: center;
  padding: 48px clamp(24px, 6vw, 96px);
}

.hero {
  max-width: 520px;
}

@keyframes ribbon-enter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ribbon-group-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ribbon {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ribbon-bg);
  border-bottom: 1px solid var(--ribbon-edge);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: ribbon-enter 0.45s ease;
}

.ribbon::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 55%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 6px);
  opacity: 0.5;
}

.ribbon>* {
  position: relative;
  z-index: 1;
}

.ribbon-top {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 14px clamp(20px, 4vw, 72px);
}

.ribbon-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.ribbon-brand-text {
  display: grid;
  gap: 4px;
}

.ribbon-app {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(245, 246, 248, 0.6);
  font-weight: 600;
}

.ribbon-sep {
  width: 1px;
  align-self: stretch;
  background: rgba(255, 255, 255, 0.12);
}

.ribbon-doc {
  margin: 0;
  font-family: "Merriweather", "Georgia", serif;
  font-size: clamp(20px, 2.4vw, 32px);
}

.ribbon .logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.ribbon-quick {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ribbon-quick-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  padding: 0;
  font-size: 0;
  cursor: pointer;
}

.ribbon-quick-btn::before {
  content: "";
  position: absolute;
  inset: 7px;
  background: no-repeat center / contain;
  opacity: 0.8;
}

.ribbon-quick-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ribbon-quick-btn[data-icon="save"]::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z'/><polyline points='17 21 17 13 7 13 7 21'/><polyline points='7 3 7 8 15 8'/></svg>");
}

.ribbon-quick-btn[data-icon="undo"]::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 4 1 10 7 10'/><path d='M3.51 15a9 9 0 1 0 2.13-9.36L1 10'/></svg>");
}

.ribbon-quick-btn[data-icon="redo"]::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='23 4 23 10 17 10'/><path d='M20.49 15a9 9 0 1 1-2.13-9.36L23 10'/></svg>");
}

.ribbon-session {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ribbon-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px clamp(20px, 4vw, 72px);
  background: var(--ribbon-pane);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ribbon-tab {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--ribbon-tab);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ribbon-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

body[data-page="dashboard"] .ribbon-tab[data-page="dashboard"],
body[data-page="societes"] .ribbon-tab[data-page="societes"],
body[data-page="devis"] .ribbon-tab[data-page="devis"],
body[data-page="commandes-client"] .ribbon-tab[data-page="commandes-client"],
body[data-page="commandes-fournisseur"] .ribbon-tab[data-page="commandes-fournisseur"],
body[data-page="notes-frais"] .ribbon-tab[data-page="notes-frais"],
body[data-page="factures"] .ribbon-tab[data-page="factures"],
body[data-page="facture-detail"] .ribbon-tab[data-page="factures"],
body[data-page="suivi-affaire"] .ribbon-tab[data-page="suivi-affaire"],
body[data-page="pvr"] .ribbon-tab[data-page="pvr"],
body[data-page="pointages-synthese"] .ribbon-tab[data-page="pointages-synthese"],
body[data-page="parametres"] .ribbon-tab[data-page="parametres"],
body[data-page="statistiques"] .ribbon-tab[data-page="statistiques"] {
  background: var(--ribbon-tab-active);
  border-color: rgba(47, 107, 255, 0.35);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.2);
}

.ribbon-tab.gold {
  color: #ffd700 !important;
  border-color: rgba(255, 215, 0, 0.3);
  font-weight: 700;
}

.ribbon-tab.gold:hover {
  background: rgba(255, 215, 0, 0.1) !important;
  border-color: rgba(255, 215, 0, 0.5);
}

.ribbon-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 14px clamp(20px, 4vw, 72px) 18px;
  background: rgba(10, 14, 22, 0.75);
}

.ribbon-group {
  display: grid;
  gap: 8px;
  padding-right: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  animation: ribbon-group-enter 0.45s ease both;
}

.ribbon-group:nth-child(1) {
  animation-delay: 0.05s;
}

.ribbon-group:nth-child(2) {
  animation-delay: 0.12s;
}

.ribbon-group:nth-child(3) {
  animation-delay: 0.18s;
}

.ribbon-group:last-child {
  border-right: none;
  padding-right: 0;
}

.ribbon-group-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ribbon-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(245, 246, 248, 0.5);
}

.ribbon-group-wide {
  min-width: 240px;
  flex: 1;
}

.ribbon-tool {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
}

.ribbon-tool:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.ribbon-search {
  width: min(340px, 100%);
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink);
  font-size: 13px;
}

.ribbon-search::placeholder {
  color: rgba(245, 246, 248, 0.6);
}

.ribbon-hint {
  font-size: 12px;
  color: var(--muted);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px clamp(24px, 6vw, 96px);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.title {
  margin: 4px 0 0;
  font-family: "Merriweather", "Georgia", serif;
  font-size: clamp(26px, 3vw, 36px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user {
  font-weight: 600;
  color: var(--teal);
}

.user:empty {
  display: none;
}

.user:empty+#logoutBtn {
  display: none;
}


.dashboard {
  padding: 24px clamp(24px, 6vw, 96px) 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Stunning Nouveautés Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.9);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 40px;
  width: min(580px, 90vw);
  max-height: 85vh;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 40px 120px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  transform: translateY(40px) scale(0.95);
  transition: all 0.7s cubic-bezier(0.19, 1, 0.22, 1);
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-body {
  padding: 60px 50px;
  overflow-y: auto;
  text-align: center;
}

.modal-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.modal-brand .brand-logo {
  width: 54px;
  height: 54px;
  background: #2f6bff;
  color: #fff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 20px;
  font-family: "Space Grotesk", sans-serif;
  box-shadow: 0 10px 25px rgba(47, 107, 255, 0.4);
}

.modal-brand .brand-name {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}


.modal-body h2 {
  margin: 0 0 40px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 40%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.changelog-container {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-bottom: 60px;
}

.version-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.version-header-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-header-line .v-number {
  font-weight: 700;
  color: #fff;
  font-size: 18px;
}

.version-header-line .v-date {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.new-badge {
  background: #2f6bff;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.changelog-premium-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 16px 20px;
  border-radius: 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all 0.3s ease;
}

.version-block.is-new .changelog-premium-item {
  background: rgba(47, 107, 255, 0.05);
  border-color: rgba(47, 107, 255, 0.1);
}

.changelog-premium-item:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(4px);
}

.changelog-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  margin-top: 6px;
  flex-shrink: 0;
}

.version-block.is-new .changelog-dot {
  background: #2f6bff;
  box-shadow: 0 0 10px rgba(47, 107, 255, 0.6);
}

.changelog-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

.version-block.is-new .changelog-text {
  color: #fff;
}

.modal-top-actions {
  margin-bottom: 32px;
  display: flex;
  justify-content: center;
}

#vCloseBtn {
  background: #2f6bff;
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
  box-shadow: 0 10px 20px rgba(47, 107, 255, 0.2);
}

#vCloseBtn:hover {
  transform: translateY(-2px);
  background: #3d79ff;
  box-shadow: 0 15px 30px rgba(47, 107, 255, 0.3);
}

#vCloseBtn:active {
  transform: scale(0.98);
}

.split {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 24px;
  background: transparent;
  padding: 0;
}

.list {
  background: #0f141c;
  color: var(--ink);
  padding: 18px;
  border-radius: 14px;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.details {
  background: var(--panel-strong);
  border-radius: 14px;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none;
  min-height: 520px;
}

.toolbar {
  margin-bottom: 12px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.toolbar-row select {
  flex: 1;
  margin-bottom: 0;
}

body[data-page="suivi-affaire"] .toolbar-row.suivi-filters {
  flex-wrap: wrap;
}

body[data-page="suivi-affaire"] .toolbar-row.suivi-filters>* {
  flex: 1 1 220px;
  min-width: 200px;
}

body[data-page="suivi-affaire"] .toolbar-row.suivi-filters .filter-number {
  flex: 0 1 220px;
}

.pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pager-btn {
  padding: 6px 10px;
  min-width: 34px;
  text-align: center;
}

.pager-label {
  min-width: 70px;
  text-align: center;
}

.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  white-space: nowrap;
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ghost.danger {
  border-color: rgba(255, 77, 77, 0.4);
  color: #ff9e9e;
}

.ghost.danger:hover {
  background: rgba(255, 77, 77, 0.12);
}

.toolbar input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.toolbar input::placeholder {
  color: rgba(245, 246, 248, 0.65);
}

.toolbar select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  margin-bottom: 10px;
  color-scheme: dark;
}

.list-body {
  display: grid;
  gap: 8px;
  max-height: 70vh;
  overflow: auto;
  padding-right: 4px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  text-align: left;
}

.contact-row {
  align-items: center;
}

.contact-main {
  flex: 1;
}

.contact-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon.danger {
  border-color: rgba(255, 77, 77, 0.4);
  color: #ff9e9e;
}

.icon.danger:hover {
  background: rgba(255, 77, 77, 0.12);
}

.list-item:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.affaire-choice.selected {
  border-color: rgba(47, 107, 255, 0.6);
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.2);
}

.suivi-list {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.medaillon {
  width: 100%;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  margin-bottom: 24px;
}

.medaillon:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.medaillon-summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.2s ease;
}

.medaillon-summary::-webkit-details-marker {
  display: none;
}

.medaillon-summary::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--medaillon-color, var(--accent));
  opacity: 0.9;
}

.medaillon-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.medaillon[open] .medaillon-summary {
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.medaillon-main {
  display: grid;
  gap: 4px;
}

.medaillon-name {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 16px;
}

.medaillon-designation {
  color: var(--muted);
  font-size: 13px;
}

.medaillon-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.medaillon-toggle {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.medaillon-toggle::before {
  content: "+";
}

.medaillon[open] .medaillon-toggle::before {
  content: "-";
}

.medaillon-body {
  display: grid;
  gap: 12px;
  padding: 12px 16px 16px;
}

.medaillon-info {
  display: grid;
  gap: 6px;
}

.medaillon-info-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.medaillon-info-label {
  min-width: 90px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.medaillon-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.medaillon-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.medaillon-editable {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.medaillon-editable-text {
  flex: 1 1 auto;
  min-width: 0;
  word-break: break-word;
}

.medaillon-editable-text.is-empty {
  color: var(--muted);
  font-style: italic;
}

.medaillon-inline-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #1e293b;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  resize: vertical;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.medaillon-inline-input:focus {
  outline: 2px solid rgba(47, 107, 255, 0.35);
  border-color: var(--accent);
}

.medaillon-inline-input option {
  background-color: #1a1f26;
  color: #fff;
}

.medaillon-inline-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.medaillon-inline-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
}

.medaillon-inline-btn::before {
  content: "";
  position: absolute;
  inset: 6px;
  background: no-repeat center / contain;
  opacity: 0.7;
}

.medaillon-inline-btn.icon-pencil::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20h9'/><path d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/></svg>");
}

.medaillon-inline-btn.icon-check::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
}

.medaillon-inline-btn.icon-cancel::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='6' x2='6' y2='18'/><line x1='6' y1='6' x2='18' y2='18'/></svg>");
}

.medaillon:not([open]) .inline-edit {
  display: none;
}

.ratio-badge {
  background: var(--ratio-color, rgba(255, 255, 255, 0.12));
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.reunion {
  background: rgba(255, 214, 102, 0.2);
  color: #ffd666;
}

.suivi-grid {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.suivi-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.suivi-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.suivi-col .suivi-col-header h4 {
  margin: 0;
}

.suivi-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.suivi-add-btn::before {
  inset: 6px;
}

.suivi-col h4 {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.suivi-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 13px;
  max-height: clamp(160px, 35vh, 260px);
  overflow-y: auto;
  padding-right: 6px;
}

.suivi-items li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.suivi-items a {
  color: inherit;
  text-decoration: none;
}

.suivi-items a:hover {
  text-decoration: underline;
}

.suivi-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suivi-item-value {
  font-weight: 600;
}

.suivi-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .medaillon-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .medaillon-meta {
    width: 100%;
    justify-content: space-between;
  }
}

.devis-row {
  align-items: flex-start;
  justify-content: flex-start;
}

.devis-action {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  align-self: center;
}

.devis-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.devis-star {
  color: #f5c542;
  font-size: 14px;
  line-height: 1;
}

.devis-meta {
  display: grid;
  gap: 4px;
  text-align: right;
  min-width: 170px;
  margin-left: auto;
}

.devis-sub {
  color: var(--muted);
  font-size: 13px;
}

.devis-amount {
  font-weight: 600;
}

.devis-modal {
  width: min(980px, 92vw);
}

.devis-info {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.devis-block {
  margin-top: 20px;
}

.devis-block h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

.devis-conditions {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.devis-lines-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.devis-lines {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: rgba(255, 255, 255, 0.02);
}

.devis-lines col.col-ref {
  width: 12%;
}

.devis-lines col.col-desig {
  width: 65.6%;
}

.devis-lines col.col-pu {
  width: 6.4%;
}

.devis-lines col.col-qte {
  width: 4%;
}

.devis-lines input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.devis-lines input[type="number"]::-webkit-outer-spin-button,
.devis-lines input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.devis-lines col.col-tva {
  width: 3.4%;
}

.devis-lines col.col-taille {
  width: 1.5%;
}

.devis-lines col.col-style {
  width: 1.5%;
}

.devis-lines col.col-total {
  width: 2.1%;
}

.devis-lines col.col-action {
  width: 2.1%;
}

.devis-lines th,
.devis-lines td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  font-size: 13px;
}

.devis-lines input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 12px;
}

.designation-cell {
  position: relative;
}

.designation-display {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
  line-height: 1.2;
  cursor: text;
  min-height: 2.4em;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.designation-display:empty::before {
  content: "Saisir designation";
  color: var(--muted);
}

.designation-input {
  display: none;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 12px;
}

.devis-lines tr.editing .designation-display {
  display: none;
}

.devis-lines tr.editing .designation-input {
  display: block;
}

.icon-save,
.icon-add,
.icon-duplicate,
.icon-delete,
.icon-document {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  position: relative;
}

.icon-save:disabled,
.icon-add:disabled,
.icon-duplicate:disabled,
.icon-delete:disabled,
.icon-document:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-save::before,
.icon-add::before,
.icon-duplicate::before,
.icon-delete::before,
.icon-document::before {
  content: "";
  position: absolute;
  inset: 7px;
  background: no-repeat center / contain;
  opacity: 0.6;
}

.icon-save::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z'/><polyline points='17 21 17 13 7 13 7 21'/><polyline points='7 3 7 8 15 8'/></svg>");
}

.icon-add::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='12' y1='5' x2='12' y2='19'/><line x1='5' y1='12' x2='19' y2='12'/></svg>");
}

.icon-duplicate::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='9' y='9' width='13' height='13' rx='2' ry='2'/><path d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/></svg>");
}

.icon-document::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14 2H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/><polyline points='14 2 14 8 20 8'/><line x1='9' y1='13' x2='15' y2='13'/><line x1='9' y1='17' x2='15' y2='17'/></svg>");
}

.icon-delete {
  border-color: rgba(255, 77, 77, 0.4);
}

.icon-delete:hover {
  background: rgba(255, 77, 77, 0.12);
}

.icon-delete::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff7a7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 6 5 6 21 6'/><path d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/><path d='M10 11v6'/><path d='M14 11v6'/><path d='M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2'/></svg>");
  opacity: 1;
}

.icon-save.active {
  border-color: rgba(45, 182, 163, 0.55);
  box-shadow: 0 0 0 2px rgba(45, 182, 163, 0.2);
}

.icon-save.active::before {
  opacity: 1;
}

.header-save {
  width: 38px;
  height: 38px;
}

.devis-lines th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.devis-lines td.num,
.devis-lines th.num {
  text-align: right;
  white-space: nowrap;
}

.line-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.line-actions .icon-save,
.line-actions .icon-delete {
  width: 30px;
  height: 30px;
}

.line-actions .icon-save::before,
.line-actions .icon-delete::before {
  inset: 6px;
}

.order-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-cell .order-input {
  width: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 0;
}

.order-cell input[type="text"] {
  flex: 2;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 10px;
  cursor: grab;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.devis-lines tr.dragging {
  opacity: 0.6;
}

.devis-lines td:nth-child(3) input {
  text-align: right;
}

.devis-lines td:nth-child(4) input {
  text-align: center;
}

.devis-lines .size-input {
  text-align: center;
}

.style-toggle {
  display: inline-flex;
  gap: 4px;
}

.style-btn {
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.style-btn.active {
  border-color: rgba(45, 182, 163, 0.55);
  color: var(--ink);
  box-shadow: 0 0 0 2px rgba(45, 182, 163, 0.2);
}

.devis-totals {
  margin-top: 18px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.badge {
  background: rgba(47, 107, 255, 0.2);
  color: #cfe0ff;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.badge-count {
  background: #ff4d4d;
  color: #fff;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  margin-left: 6px;
  display: inline-block;
  line-height: 1;
  box-shadow: 0 0 8px rgba(255, 77, 77, 0.4);
}

.detail-body {
  margin-top: 16px;
}

.tabs {
  display: flex;
  gap: 18px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.tab.hidden {
  display: none;
}

.tab {
  border: none;
  background: transparent;
  padding: 6px 2px 10px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  position: relative;
}

.tab.active {
  color: #fff;
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.stats-header h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.stats-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.stats-meta .meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.stats-meta .meta-value {
  font-size: 18px;
  font-weight: 600;
}

.chart-vertical {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(26px, 1fr);
  gap: 12px;
  align-items: end;
  height: 220px;
  padding: 12px 6px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow-x: auto;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 10px;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.chart-legend-item.is-off {
  opacity: 0.35;
  text-decoration: line-through;
}

.chart-legend-item.is-off .legend-swatch {
  filter: grayscale(100%);
}

.chart-months {
  display: grid;
  grid-template-columns: repeat(12, minmax(36px, 1fr));
  gap: 12px;
  align-items: stretch;
  height: 260px;
  padding: 12px 6px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow-x: auto;
}

.month-group {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  align-items: end;
  min-height: 220px;
  height: 100%;
  align-self: stretch;
}

.month-bars {
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  align-items: end;
  height: 100%;
}

.month-bar {
  width: 100%;
  border-radius: 6px 6px 4px 4px;
  min-height: 2px;
}

.month-label {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.stats-view {
  display: grid;
  gap: 18px;
}

.stats-section {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.stats-subhead h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.stats-subhead p {
  margin: 0;
}

.line-chart {
  display: grid;
  gap: 10px;
}

.line-chart-plot {
  position: relative;
  min-height: 260px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(47, 107, 255, 0.12), rgba(45, 182, 163, 0.04)),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 1px, transparent 1px, transparent 52px);
  overflow: hidden;
}

.line-chart-plot svg {
  width: 100%;
  height: 100%;
  display: block;
}

.line-area {
  opacity: 0.75;
}

.line-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 16px rgba(15, 17, 21, 0.45));
}

.line-path.multi {
  stroke-width: 2.2;
  filter: none;
  opacity: 0.95;
}

.line-point {
  fill: var(--accent);
  stroke: #0f1115;
  stroke-width: 2;
}

.line-point.multi {
  stroke-width: 1.5;
  opacity: 0.9;
}

.multi-series.is-hidden {
  display: none;
}

.line-point.is-peak {
  fill: var(--teal);
}

.line-point.is-latest {
  fill: #f5c542;
}

.line-axis {
  display: grid;
  gap: 8px;
  padding: 0 2.5%;
  font-size: 11px;
  text-align: center;
  color: var(--muted);
}

.line-axis span {
  white-space: nowrap;
}

.line-scale {
  position: absolute;
  right: 12px;
  top: 12px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}

.line-scale span {
  background: rgba(12, 16, 24, 0.75);
  padding: 2px 6px;
  border-radius: 999px;
  align-self: flex-end;
}

.line-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.vbar {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  align-items: end;
  min-height: 200px;
}

.vbar-fill {
  width: 100%;
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.9), rgba(45, 182, 163, 0.9));
  border-radius: 8px 8px 6px 6px;
}

.vbar-year {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.pie-card {
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  grid-template-columns: 180px 1fr 1fr;
  gap: 20px;
  align-items: center;
}

.pie-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 6px;
}

.pie-suppliers h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.suppliers-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.supplier-item {
  display: grid;
  grid-template-columns: 1fr 1.2fr 110px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  --pos: 50%;
}

.supplier-name {
  color: var(--ink);
  font-weight: 600;
}

.supplier-line {
  position: relative;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.supplier-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--pos);
  background: linear-gradient(90deg, rgba(45, 182, 163, 0.9), rgba(47, 107, 255, 0.85));
}

.supplier-dot {
  position: absolute;
  top: -4px;
  left: calc(var(--pos) - 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f6bff;
  box-shadow: 0 0 0 4px rgba(47, 107, 255, 0.18);
}

.supplier-value {
  text-align: right;
  color: var(--ink);
  font-weight: 600;
}

.pie {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}

.pie::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: var(--panel-strong);
}

.pie-label,
.pie-value {
  position: relative;
  z-index: 1;
  text-align: center;
}

.pie-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.pie-value {
  font-size: 16px;
  font-weight: 600;
}

.pie-meta h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.pie-legend {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.swatch-ca {
  background: #2f6bff;
}

.swatch-net {
  background: #2db6a3;
}

.hidden {
  display: none !important;
}

.contacts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.contacts-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 16px;
}

.contacts-list {
  display: grid;
  gap: 8px;
  max-height: 60vh;
  overflow: auto;
  padding-right: 4px;
}

.contact-form {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.devis-form {
  display: grid;
  gap: 12px;
}

.ribbon-tool.active {
  background: rgba(47, 107, 255, 0.18);
  border-color: rgba(47, 107, 255, 0.45);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.15);
}

.frais-row {
  align-items: flex-start;
}

.frais-meta {
  display: grid;
  gap: 4px;
  text-align: right;
  min-width: 120px;
  margin-left: auto;
}

.frais-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  width: 100%;
  margin-top: 8px;
}

.frais-form .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.frais-form .designation-field {
  grid-column: 1 / -1;
}

.frais-form .form-grid>label,
.frais-form .form-grid input,
.frais-form .form-grid select {
  min-width: 0;
}

.frais-field.hidden {
  display: none;
}

.scan-modal {
  width: min(980px, 94vw);
}

.scan-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, 320px) 1fr;
}

.scan-preview {
  min-height: 240px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.scan-preview img,
.scan-preview iframe,
.scan-preview embed {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
}

.scan-fields {
  display: grid;
  gap: 12px;
}

.scan-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.document-modal {
  width: min(900px, 94vw);
}

.document-preview {
  min-height: 60vh;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.document-preview img,
.document-preview iframe,
.document-preview embed {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
}

@media (max-width: 900px) {
  .scan-layout {
    grid-template-columns: 1fr;
  }

  .scan-preview {
    min-height: 200px;
  }
}

@media (max-width: 720px) {
  .frais-form .form-grid {
    grid-template-columns: 1fr;
  }
}

.frais-card {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.frais-card summary {
  list-style: none;
}

.frais-card summary::marker {
  content: "";
}

.frais-card summary::-webkit-details-marker {
  display: none;
}

.frais-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
}

.frais-summary-label {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frais-summary-amount {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.frais-summary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.frais-summary .icon-document {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.frais-card[open] .frais-summary {
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.frais-details {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
}

.frais-detail-grid {
  display: grid;
  gap: 6px;
}

.frais-detail-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  font-size: 12px;
  align-items: baseline;
}

.frais-detail-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.frais-detail-edit .frais-detail-value {
  flex: 1 1 auto;
  min-width: 0;
}

.frais-detail-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-size: 10px;
}

.frais-detail-value {
  color: var(--ink);
  word-break: break-word;
}

.note-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.note-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.note-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.note-lists {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.note-list-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.devis-header {
  display: grid;
  gap: 12px;
}

.devis-form .devis-row {
  display: grid;
  gap: 10px;
  align-items: end;
}

.devis-form .devis-row.row-1 {
  grid-template-columns:
    minmax(120px, 0.28fr) minmax(110px, 0.25fr) minmax(110px, 0.25fr) minmax(20px, 1fr) minmax(170px, 0.25fr) minmax(120px, 0.12fr);
}

body[data-page="commandes-client"] .devis-form .devis-row.row-1 {
  grid-template-columns:
    minmax(120px, 0.2fr) minmax(110px, 0.15fr) minmax(220px, 0.3fr) 20px minmax(300px, 1fr) minmax(150px, 0.25fr);
}

.devis-form .devis-row.row-2 {
  grid-template-columns: 1fr;
}

body[data-page="commandes-client"] .devis-form .devis-row.row-2 {
  grid-template-columns: 1fr;
}

.devis-form .devis-row.row-3 {
  grid-template-columns: repeat(5, minmax(160px, 1fr));
}

.devis-form .devis-row.row-4 {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.devis-form .devis-row.row-5 {
  grid-template-columns: minmax(260px, 1fr);
}

.devis-form .devis-row.row-4col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.devis-form .devis-row.row-3col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.devis-form .devis-row.row-2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.devis-form .devis-row .align-right {
  text-align: right;
  justify-self: end;
}

.devis-form .field-delai,
.devis-form .field-validite {
  text-align: center;
}

.devis-form .field-delai.align-right,
.devis-form .field-validite.align-right {
  text-align: center;
  justify-self: stretch;
}

.devis-form .field-delai input,
.devis-form .field-validite input {
  text-align: center;
}

.row-spacer {
  min-height: 1px;
}

.devis-actions-left,
.devis-actions-center {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.devis-actions-center {
  justify-self: center;
}

.devis-actions-left .muted {
  font-size: 12px;
}

.devis-totals-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-self: end;
}

.devis-total {
  display: grid;
  gap: 4px;
  text-align: right;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  min-width: 130px;
}

.devis-total input {
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 16px !important;
  text-align: right;
  padding: 0;
  width: 100%;
}

.devis-total.highlight {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.08);
}

.devis-total>div:last-child {
  font-size: 16px;
  font-weight: 600;
}

.form-grid.coord-grid {
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
}

.form-grid.coord-grid .addr {
  grid-column: span 2;
}

.form-grid.coord-grid .field-short {
  max-width: 140px;
}

.form-grid.coord-grid .field-tiny {
  max-width: 140px;
}

.form-grid.coord-grid .field-medium {
  max-width: 220px;
}

.form-grid.coord-grid .field-wide {
  min-width: 260px;
}

.form-grid.coord-grid .span-2 {
  grid-column: span 2;
}

.form-grid label,
.devis-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.form-grid input,
.form-grid textarea,
.devis-form input,
.contact-form textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.field-fact-inter input {
  background: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
  color: #fff !important;
  font-weight: 600;
}

.field-fact-inter {
  color: var(--accent) !important;
}

.form-grid select,
.devis-form select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  color-scheme: dark;
}

.form-grid select option,
.devis-form select option {
  background: #0f141c;
  color: var(--ink);
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid textarea {
  min-height: 72px;
  resize: vertical;
}

.form-grid .preview-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.preview-box {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.preview-box span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.preview-box strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.toolbar select option {
  background: #0f141c;
  color: var(--ink);
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.detail-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.contacts {
  display: grid;
  gap: 10px;
}

.contact {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.contact-search-modal {
  width: min(980px, 92vw);
}

.contact-search-layout {
  grid-template-columns: minmax(220px, 320px) 1fr;
}

.contact-search-detail {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  padding: 16px;
  min-height: 220px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.contact-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contact-detail-header h4 {
  margin: 0;
}

.contact-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.contact-detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 12, 16, 0.75);
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(720px, 92vw);
  max-height: 85vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.icon {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
}

.icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

.toast {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 12, 16, 0.7);
  z-index: 70;
}

.toast-card {
  padding: 16px 22px;
  border-radius: 12px;
  background: rgba(47, 107, 255, 0.95);
  color: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  font-size: 16px;
  text-align: center;
  min-width: 220px;
}

.toast.hidden {
  display: none;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.map {
  width: 100%;
  height: 440px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

@media (max-width: 900px) {
  .ribbon-top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .ribbon-brand {
    flex-wrap: wrap;
  }

  .ribbon-sep {
    display: none;
  }

  .ribbon-doc {
    flex-basis: 100%;
  }

  .ribbon-group {
    width: 100%;
    border-right: none;
    padding-right: 0;
  }

  .ribbon-group-body {
    align-items: stretch;
  }

  .ribbon-tool {
    width: 100%;
    text-align: left;
  }

  .ribbon-search {
    width: 100%;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .details {
    width: 100%;
  }

  .tab-view {
    width: 100%;
  }

  .contacts-layout {
    grid-template-columns: 1fr;
  }

  .contact-form,
  .contacts-list {
    width: 100%;
  }

  .map {
    height: 360px;
  }

  .form-grid.coord-grid .span-2,
  .form-grid.coord-grid .addr {
    grid-column: span 1;
    min-width: 0;
  }

  .devis-form .devis-row.row-1,
  .devis-form .devis-row.row-2,
  .devis-form .devis-row.row-3 {
    grid-template-columns: 1fr;
  }

  .devis-form .devis-row.row-4 {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .devis-totals-inline {
    justify-self: start;
    justify-content: flex-start;
  }

  .stats-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-vertical {
    height: 180px;
  }

  .chart-months {
    height: 180px;
  }

  .line-chart-plot {
    min-height: 220px;
  }

  .line-scale {
    right: 8px;
  }

  .month-group {
    min-height: 160px;
  }

  .pie-card {
    grid-template-columns: 1fr;
  }

  .supplier-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .supplier-value {
    text-align: left;
  }

  .devis-meta {
    text-align: left;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.tag {
  margin: 0;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: rgba(245, 246, 248, 0.5);
}

h1 {
  margin: 4px 0 0;
  font-family: "Merriweather", "Georgia", serif;
  font-size: clamp(32px, 4vw, 48px);
}

.intro {
  margin: 24px 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(47, 107, 255, 0.16);
  color: #cfe0ff;
  font-weight: 600;
  font-size: 14px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.card {
  background: var(--panel);
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 12px 24px var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.sub {
  margin: 0 0 24px;
  color: var(--muted);
}

.form {
  display: grid;
  gap: 16px;
}

label span {
  display: block;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(47, 107, 255, 0.35);
  border-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--ink);
}

.secondary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.pdf-btn {
  position: relative;
  padding-left: 40px;
}

.pdf-btn::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background: no-repeat center / contain;
  opacity: 0.7;
}

.pdf-btn.pdf-portrait::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><rect x='6' y='3' width='12' height='18' rx='2'/><line x1='8' y1='8' x2='16' y2='8'/></svg>");
}

.pdf-btn.pdf-landscape::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd2dc' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='6' width='18' height='12' rx='2'/><line x1='7' y1='9' x2='17' y2='9'/></svg>");
}

.link {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}

.help {
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .page {
    grid-template-columns: 1fr;
  }

  .card {
    order: 2;
  }
}

.affaire-box {
  background: rgba(47, 107, 255, 0.1);
  border: 1px solid rgba(47, 107, 255, 0.2);
  padding: 12px;
  border-radius: 8px;
  margin-top: 10px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.blue {
  background: #2f6bff;
  color: #fff;
}

.badge.green {
  background: #2db6a3;
  color: #fff;
}

.selectable {
  transition: transform 0.2s, background 0.2s;
}

.selectable:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.selectable.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.total-row.ttc td {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--ink);
  border-top: 2px solid var(--accent);
}

/* DASHBOARD GRID AND CARDS */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.dashboard-card {
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(12px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.3s ease;
  min-height: 240px;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.card-body {
  flex: 1;
}

.brief-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.brief-item {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.brief-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brief-item-right {
  font-weight: 700;
  color: var(--teal);
}

.card-footer {
  margin-top: auto;
}

.tool-btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.tool-btn:hover {
  background: var(--accent-dark);
}

.devis-actions-center {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-right: auto;
}

.pdf-btn::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><polyline points='14 2 14 8 20 8'/><line x1='16' y1='13' x2='8' y2='13'/><line x1='16' y1='17' x2='8' y2='17'/><polyline points='10 9 9 9 8 9'/></svg>");
  opacity: 0.8;
  vertical-align: middle;
}

.excel-btn::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/><polyline points='14 2 14 8 20 8'/><line x1='8' y1='13' x2='16' y2='13'/><line x1='8' y1='17' x2='16' y2='17'/><line x1='8' y1='9' x2='10' y2='9'/></svg>");
  opacity: 0.8;
  vertical-align: middle;
}
/* Facture Pay�e */
.paid-stamp {
  position: absolute;
  top: 150px;
  left: 50%;
  transform: translateX(-50%) rotate(-15deg);
  border: 10px solid #10b981;
  color: #10b981;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 8rem;
  font-weight: 800;
  padding: 1rem 3rem;
  text-transform: uppercase;
  border-radius: 1.5rem;
  opacity: 0.15;
  pointer-events: none;
  z-index: 100;
  letter-spacing: 0.8rem;
  user-select: none;
  box-shadow: 0 0 40px #059669, inset 0 0 20px #059669;
}

.paid-checkbox-container {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  color: #fff;
  background: rgba(16, 185, 129, 0.2);
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.paid-checkbox-container:hover {
  background: rgba(16, 185, 129, 0.35);
  border-color: rgba(16, 185, 129, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.paid-checkbox-container input {
  margin: 0;
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #10b981;
}

.badge.green {
  background: rgba(16, 185, 129, 0.25);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge.payee {
  background: #10b981;
  color: #fff !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.paid-card {
  border-left: 4px solid #10b981 !important;
  background: rgba(16, 185, 129, 0.05) !important;
}

.paid-card:hover {
  background: rgba(16, 185, 129, 0.1) !important;
}


.mini-paid-stamp {
  position: absolute;
  top: 10px;
  right: 15px;
  transform: rotate(-10deg);
  border: 2px solid #10b981;
  color: #10b981;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 4px;
  opacity: 0.4;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.list-summary {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
  font-size: 0.95rem;
}

.success-text { color: #10b981; }
.warning-text { color: #f59e0b; }


.stat-group {
    display: flex;
    flex-direction: column;
}
.stat-main {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 2px;
}
.list-summary .small {
    font-size: 0.8rem;
    opacity: 0.7;
}
.ratio-badge {
  background: var(--ratio-color, #10b981);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  margin-right: 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.ratio-badge.hidden {
  display: none;
}

/* --- Import Modal Premium Styles --- */
.import-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  height: 520px;
  margin-top: 10px;
}

.import-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.col-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}

.import-list {
  flex: 1;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 10px;
}

.import-item {
  width: 100%;
  text-align: left;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 10px;
  display: block;
}

.import-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.import-item.selected {
  background: rgba(47, 107, 255, 0.12);
  border-color: rgba(47, 107, 255, 0.4);
  box-shadow: 0 4px 12px rgba(47, 107, 255, 0.1);
}

.import-item strong {
  display: block;
  font-size: 14px;
  color: #fff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-item .description {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.import-item .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
  margin-top: 8px;
}

.import-item .meta span:last-child {
  color: var(--accent, #60a5fa);
  font-weight: 600;
}

/* Custom Scrollbar for Import Lists */
.import-list::-webkit-scrollbar {
  width: 6px;
}
.import-list::-webkit-scrollbar-track {
  background: transparent;
}
.import-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.import-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Autocomplete search results style */
.autocomplete-container {
  position: relative;
  width: 100%;
}

.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #141923;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.autocomplete-item {
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  transition: background 0.2s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.autocomplete-item strong {
  color: #fff;
}

.autocomplete-item .muted {
  font-size: 11px;
  color: var(--muted);
}

.client-list-container {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.client-assoc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.client-assoc-row span {
  font-weight: 500;
}

.client-assoc-row button.danger-btn {
  background: transparent;
  color: #ff9e9e;
  border: 1px solid rgba(255, 77, 77, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.client-assoc-row button.danger-btn:hover {
  background: rgba(255, 77, 77, 0.1);
  border-color: rgba(255, 77, 77, 0.6);
}

/* Timeline Selector Styles */
.timeline-container {
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.timeline-container::-webkit-scrollbar {
  display: none;
}

.timeline-years {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 4px;
  border-radius: 12px;
  width: fit-content;
  white-space: nowrap;
}

.timeline-year-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.timeline-year-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.timeline-year-btn.active {
  color: #fff;
  background: #2f6bff;
  box-shadow: 0 4px 12px rgba(47, 107, 255, 0.3);
}
