:root {
  --color-primary: #438DD7;
  --color-primary-dark: #203756;
  --color-text: #000000;
  --color-text-muted: #666666;
  --color-text-subtle: #999999;
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-border: #e5e5e5;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --shadow-glass: 0 22px 48px rgba(27, 44, 80, 0.10);
  --shadow-glass-lg: 0 30px 70px rgba(27, 44, 80, 0.14);
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, 0.15) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--color-text);
  background:
    radial-gradient(1200px 600px at 0% -10%, rgba(67, 141, 215, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(32, 55, 86, 0.08), transparent 60%),
    var(--color-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "kern", "liga";
}

button, input, textarea, select { font: inherit; }
button { border: 0; background: transparent; color: inherit; }
a { color: var(--color-primary); text-decoration: none; transition: color 0.18s ease; }
a:hover { color: var(--color-primary-dark); }
::selection { background-color: rgba(67, 141, 215, 0.2); }

h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(2rem, 3vw, 3rem); line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 2.2vw, 2rem); line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; line-height: 1.2; font-weight: 700; }
h4 { font-size: 1rem; line-height: 1.35; font-weight: 600; }

.app-shell { min-height: 100vh; }
.layout-grid { display: block; min-height: 100vh; max-width: 100vw; }
.layout-main { min-height: 100vh; margin-left: 240px; display: flex; flex-direction: column; min-width: 0; }
.layout-content { flex: 1; }
.content-inner {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 8rem;
}
@media (min-width: 768px) {
  .content-inner { padding: 2.5rem 2rem; }
}
@media (max-width: 767px) {
  .layout-main { margin-left: 0; }
}

.glass, .card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-glass);
  border-radius: 26px;
}

.glass-strong {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-glass);
  border-radius: 26px;
}

.card { padding: 1.25rem; }
@media (min-width: 768px) { .card { padding: 1.5rem; } }
.card.is-dropdown-host {
  position: relative;
  z-index: 10010;
}
.card-tight { padding: 0.75rem; }
.card-flat { padding: 0; overflow: hidden; }
.card-hover { transition: transform 0.28s var(--ease), box-shadow 0.28s ease, border-color 0.22s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-glass-lg); border-color: rgba(67, 141, 215, 0.30); }

.archived-company-section {
  padding: 0.75rem;
}
.archived-company-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  color: var(--color-primary-dark);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.archived-company-section summary::-webkit-details-marker {
  display: none;
}
.archived-company-section summary span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.archived-company-section summary svg {
  transition: transform 0.16s ease;
}
.archived-company-section[open] summary svg {
  transform: rotate(90deg);
}
.archived-company-section summary:hover {
  background: rgba(67, 141, 215, 0.08);
}
.archived-company-list {
  display: grid;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}
.archived-company-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.65rem;
  border-radius: 12px;
  color: inherit;
}
.archived-company-list a:hover {
  background: rgba(67, 141, 215, 0.07);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 240px;
  height: 100vh;
  padding: 1rem 0.75rem;
  border-radius: 0;
  border-right: 1px solid rgba(229, 229, 229, 0.5);
  overflow: hidden;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem 1rem;
}
.brand-logo { height: 38px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.125rem; padding: 0 0.25rem; flex-shrink: 0; }
.sidebar-section-label {
  flex-shrink: 0;
  padding: 1.25rem 0.875rem 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 12px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease);
}
.nav-item:hover { background: rgba(67, 141, 215, 0.08); color: var(--color-primary-dark); }
.nav-item-active {
  background: linear-gradient(135deg, rgba(67, 141, 215, 0.15), rgba(32, 55, 86, 0.10));
  color: var(--color-primary-dark);
  font-weight: 600;
}
.nav-item-active::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--color-primary);
  margin-left: -8px;
  margin-right: 4px;
  flex-shrink: 0;
}
.sidebar-footer { margin-top: auto; padding-top: 0.75rem; }
.user-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(229, 229, 229, 0.6);
}
.user-avatar, .avatar, .avatar-lg {
  border-radius: 9999px;
  background: linear-gradient(135deg, #438DD7, #203756);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.user-avatar { width: 36px; height: 36px; }
.avatar { width: 44px; height: 44px; font-size: 0.875rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; }
@media (max-width: 767px) { .sidebar { display: none; } }

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 0.625rem 0.75rem;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(229, 229, 229, 0.5);
}
@media (min-width: 768px) { .topbar { padding: 0.75rem 0.5rem; } }
.topbar-inner { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem; border-radius: 14px; }
.topbar-logo { height: 28px; width: auto; display: block; }
.topbar-title { font-size: 1.5rem; font-weight: 700; color: var(--color-primary-dark); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #438DD7, #203756);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.bottom-nav {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 50;
  border-radius: 22px;
  padding: 0.5rem;
  gap: 0.25rem;
}
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.4rem 0.25rem;
  border-radius: 14px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease);
}
.bn-item:active { transform: scale(0.96); }
.bn-item-active {
  background: linear-gradient(135deg, rgba(67, 141, 215, 0.15), rgba(32, 55, 86, 0.10));
  color: var(--color-primary-dark);
}
.bn-icon { display: inline-flex; align-items: center; justify-content: center; }
.bn-label { line-height: 1.1; }
@media (min-width: 768px) { .bottom-nav { display: none; } }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(67, 141, 215, 0.18), transparent 60%),
    radial-gradient(700px 400px at 100% 100%, rgba(32, 55, 86, 0.15), transparent 60%),
    var(--color-bg);
}
.login-card { width: 100%; max-width: 440px; padding: 2.5rem 2rem; border-radius: 26px; }
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.brand-img { height: 64px; width: auto; max-width: 80%; object-fit: contain; }
@media (max-width: 480px) { .login-card { padding: 1.75rem 1.25rem; border-radius: 22px; } }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.28s var(--ease), background-color 0.22s ease, box-shadow 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  background: var(--color-primary);
  color: white;
  box-shadow: 0 4px 16px rgba(67, 141, 215, 0.25);
  transition: transform 0.28s var(--ease), background-color 0.22s ease, box-shadow 0.22s ease, color 0.22s ease;
}
.btn-primary:hover { background: var(--color-primary-dark); color: white; transform: translateY(-3px); box-shadow: 0 12px 28px rgba(32, 55, 93, 0.35); }
.btn-primary:active { transform: translateY(-1px) scale(0.98); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  color: var(--color-primary-dark);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(67, 141, 215, 0.3);
  transition: transform 0.28s var(--ease), background-color 0.22s ease, box-shadow 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}
.btn-secondary:hover { background: var(--color-primary-dark); color: white; border-color: var(--color-primary-dark); transform: translateY(-3px); box-shadow: 0 12px 28px rgba(32, 55, 93, 0.20); }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s var(--ease);
}
.btn-ghost:hover { color: var(--color-primary-dark); background: rgba(255, 255, 255, 0.5); }
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: #ef4444;
  color: white;
  font-weight: 700;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25);
  font-family: inherit;
  font-size: 0.9375rem;
  text-decoration: none;
}
.btn-danger:hover { background: #dc2626; transform: translateY(-3px); box-shadow: 0 12px 28px rgba(239, 68, 68, 0.35); color: white; }
.btn-danger:active { transform: translateY(-1px) scale(0.98); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.875rem; }
.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
}
.btn-block { width: 100%; }
@media (hover: none) {
  .btn-primary:hover, .btn-secondary:hover, .card-hover:hover { transform: none; }
}

.input {
  width: 100%;
  padding: 0.625rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: white;
  color: var(--color-text);
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}
.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(67, 141, 215, 0.15);
}
.input:disabled { background: var(--color-bg); opacity: 0.7; }
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}
.native-control-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.custom-select,
.custom-color {
  position: relative;
  width: 100%;
  z-index: 70;
}
.custom-select.is-open,
.custom-color.is-open {
  z-index: 10020;
}
.custom-control-auto {
  width: auto;
  min-width: 12rem;
}
.custom-select-button,
.custom-color-button {
  width: 100%;
  min-height: 42px;
  padding: 0.625rem 2.4rem 0.625rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}
.custom-select-button::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: translateY(-65%) rotate(45deg);
}
.custom-select-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.custom-select.is-open .custom-select-button,
.custom-color.is-open .custom-color-button {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(67, 141, 215, 0.15);
}
.custom-select-menu {
  position: fixed;
  z-index: 10030;
  left: 0;
  top: 0;
}
.custom-color-menu {
  position: absolute;
  z-index: 10030;
  left: 0;
  right: 0;
  top: calc(100% + 0.375rem);
}
.custom-select-menu,
.custom-color-menu {
  display: none;
  max-height: 16rem;
  overflow: auto;
  padding: 0.375rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-glass-lg);
}
.custom-select-menu.is-open,
.custom-color.is-open .custom-color-menu {
  display: block;
}
.custom-select-search {
  position: sticky;
  top: 0;
  z-index: 1;
  display: block;
  width: 100%;
  margin-bottom: 0.35rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  color: var(--color-text);
  outline: none;
}
.custom-select-search:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(67, 141, 215, 0.12);
}
.custom-select-group {
  display: grid;
  gap: 0.15rem;
}
.custom-select-archived-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  margin: 0.35rem 0 0.15rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.custom-select-archived-toggle:hover {
  background: rgba(67, 141, 215, 0.08);
  color: var(--color-primary-dark);
}
.custom-select-chevron {
  display: inline-flex;
  width: 1rem;
  transition: transform 0.16s ease;
}
.custom-select-archived-toggle.is-open .custom-select-chevron {
  transform: rotate(90deg);
}
.custom-select-archived-count {
  margin-left: auto;
  color: var(--color-text-subtle);
  font-weight: 600;
}
.custom-select-empty {
  padding: 0.65rem 0.75rem;
  color: var(--color-text-subtle);
  font-size: 0.86rem;
}
.custom-select-option {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: 10px;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}
.custom-select-option.is-archived {
  color: var(--color-text-muted);
}
.custom-select-option.is-archived::after {
  content: "Archivée";
  float: right;
  margin-left: 0.75rem;
  color: #b45309;
  font-size: 0.7rem;
  font-weight: 700;
}
.custom-select-option:hover,
.custom-select-option.is-selected {
  background: rgba(67, 141, 215, 0.12);
  color: var(--color-primary-dark);
}
.custom-color-button {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.custom-color-swatch {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.16);
}
.custom-color-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}
.custom-color-option {
  min-height: 2.25rem;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
}
.custom-color-option.is-selected {
  border-color: var(--color-text);
}
.custom-color-input {
  font-size: 0.875rem;
  text-transform: uppercase;
}
.date-suggest-host {
  position: relative;
}
.date-suggest-menu {
  position: absolute;
  z-index: 230;
  left: 0;
  right: 0;
  top: calc(100% + 0.375rem);
  display: none;
  padding: 0.375rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-glass-lg);
}
.date-suggest-menu.is-open {
  display: grid;
  gap: 0.25rem;
}
.date-suggest-option {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.date-suggest-option:hover {
  background: rgba(67, 141, 215, 0.12);
  color: var(--color-primary-dark);
}
.dp-field {
  position: relative;
  display: block;
  width: 100%;
}
.dp-field-auto {
  display: inline-block;
  width: auto;
}
.dp-field > input {
  padding-right: 2.5rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.dp-field:not(.dp-field-auto) > input {
  width: 100%;
}
.dp-trigger {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 1.875rem;
  height: 1.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.dp-trigger:hover {
  background: rgba(67, 141, 215, 0.12);
  color: var(--color-primary-dark);
}
.dp-pop {
  position: fixed;
  z-index: 9999;
  display: none;
  width: 320px;
  max-width: calc(100vw - 16px);
  padding: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
  font-size: 0.875rem;
  user-select: none;
}
.dp-pop.is-open {
  display: block;
  animation: dp-fade 0.14s ease-out;
}
@keyframes dp-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.dp-head {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.625rem;
}
.dp-pick {
  position: relative;
  flex: 1;
  min-width: 0;
}
.dp-pick-month { flex: 1.5; }
.dp-pick-year { flex: 1; max-width: 5.5rem; }
.dp-pick-btn {
  width: 100%;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--color-primary-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.dp-pick-btn > span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.dp-pick-month .dp-pick-btn > span:first-child { text-transform: capitalize; }
.dp-pick-year .dp-pick-btn > span:first-child { font-variant-numeric: tabular-nums; }
.dp-pick-btn:hover { border-color: var(--color-primary); }
.dp-pick.is-open .dp-pick-btn {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(67, 141, 215, 0.16);
}
.dp-pick-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  flex-shrink: 0;
  opacity: 0.7;
}
.dp-pick-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  z-index: 10001;
  scrollbar-width: thin;
}
.dp-pick.is-open .dp-pick-menu { display: block; }
.dp-pick-option {
  display: block;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 0;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 6px;
}
.dp-pick-option:hover {
  background: rgba(67, 141, 215, 0.12);
  color: var(--color-primary-dark);
}
.dp-pick-option.is-selected {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
}
.dp-pick-month .dp-pick-option { text-transform: capitalize; }
.dp-pick-year .dp-pick-option { font-variant-numeric: tabular-nums; }
.dp-nav {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: var(--color-primary-dark);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.dp-nav:hover {
  background: rgba(67, 141, 215, 0.1);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.dp-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 0.25rem;
}
.dp-week span {
  padding: 0.375rem 0;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
}
.dp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-day {
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.dp-day:hover {
  background: rgba(67, 141, 215, 0.14);
  color: var(--color-primary-dark);
}
.dp-day.is-out { color: var(--color-text-muted); opacity: 0.4; }
.dp-day.is-today {
  color: var(--color-primary);
  font-weight: 800;
  opacity: 1;
  box-shadow: inset 0 0 0 1.5px var(--color-primary);
}
.dp-day.is-today.is-out { opacity: 0.55; }
.dp-day.is-selected,
.dp-day.is-selected:hover {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(67, 141, 215, 0.3);
}
.dp-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}
.dp-action {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.dp-action:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.dp-action.is-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.dp-action.is-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
}
.label { display: block; margin-bottom: 0.375rem; color: var(--color-text-muted); font-size: 0.875rem; font-weight: 600; }
.field { display: grid; gap: 0.375rem; }
.search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(229, 229, 229, 0.7);
  border-radius: 12px;
  padding: 0.5rem 0.875rem;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}
.search-wrap:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 4px rgba(67, 141, 215, 0.15); }
.search-input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: inherit; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.1;
}
.badge-dot { width: 6px; height: 6px; border-radius: 9999px; display: inline-block; flex-shrink: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background: white;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease;
}
.chip:hover { border-color: rgba(67, 141, 215, 0.35); }
.chip-active { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.dot { width: 8px; height: 8px; border-radius: 9999px; display: inline-block; flex-shrink: 0; }
.dot-lg { width: 14px; height: 14px; border-radius: 9999px; flex-shrink: 0; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; }
.table { width: 100%; font-size: 0.875rem; }
.table thead { background: rgba(255, 255, 255, 0.4); backdrop-filter: blur(8px); }
.th {
  padding: 0.75rem 1rem;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}
.td { padding: 0.875rem 1rem; vertical-align: middle; }
.row { transition: background-color 0.16s ease; }
.row:hover { background: rgba(67, 141, 215, 0.05); }
.row + .row .td { border-top: 1px solid rgba(229, 229, 229, 0.7); }
.row-archived .td { opacity: 0.65; }
.row-locked { cursor: not-allowed; }
.row-locked:hover { background: rgba(229, 229, 229, 0.20); }

.tabs-nav {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.375rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(229, 229, 229, 0.7);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.875rem;
  border-radius: 12px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.tab:hover { background: rgba(255, 255, 255, 0.8); color: var(--color-primary-dark); }
.tab-active { background: linear-gradient(135deg, rgba(67, 141, 215, 0.18), rgba(32, 55, 86, 0.10)); color: var(--color-primary-dark); font-weight: 600; }
.tab-count {
  background: rgba(67, 141, 215, 0.15);
  color: var(--color-primary-dark);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
}

.quick-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(229, 229, 229, 0.7);
}
.quick-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(229, 229, 229, 0.7);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.quick-item:hover { background: rgba(67, 141, 215, 0.08); border-color: rgba(67, 141, 215, 0.3); color: var(--color-primary-dark); }
.creator-pill { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.25); color: #92400e; }

.info-list { display: grid; gap: 0.75rem; }
.info-list > div { display: grid; grid-template-columns: 140px 1fr; align-items: baseline; }
.info-list dt { color: var(--color-text-muted); font-size: 0.875rem; }
.info-list dd { margin: 0; font-weight: 500; word-break: break-word; }
@media (max-width: 480px) { .info-list > div { grid-template-columns: 1fr; gap: 0.125rem; } }

.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  border: 1px solid;
  font-size: 0.875rem;
}
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.5rem 0.625rem;
  border-radius: 12px;
  transition: background-color 0.18s ease;
}
.upcoming-item:hover { background: rgba(67, 141, 215, 0.06); }
.upcoming-date, .date-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(67, 141, 215, 0.10), rgba(32, 55, 86, 0.05));
  border-radius: 10px;
  padding: 0.4rem 0;
}
.upcoming-date { width: 48px; }
.date-stamp { width: 56px; padding: 0.45rem 0; }
.date-stamp .day { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.date-stamp .month, .upcoming-date .month { font-size: 0.7rem; text-transform: uppercase; font-weight: 600; color: var(--color-text-muted); }

.person-card, .offer-card, .folder-card, .doc-row, .todo-row, .date-row, .user-row, .state-row, .company-row, .quote-row {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(229, 229, 229, 0.7);
  transition: border-color 0.18s ease, transform 0.18s var(--ease), box-shadow 0.18s ease, background-color 0.18s ease;
}
.person-card, .offer-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem;
  border-radius: 16px;
  color: inherit;
}
.offer-card { display: block; padding: 1rem 1.125rem; border-radius: 18px; }
.person-card:hover, .offer-card:hover, .folder-card:hover {
  border-color: rgba(67, 141, 215, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(27, 44, 80, 0.06);
}
.company-row, .doc-row, .todo-row, .date-row, .user-row, .state-row, .quote-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
}
.user-row, .state-row, .quote-row { border-radius: 14px; }
.company-row:hover, .doc-row:hover, .todo-row:hover, .date-row:hover, .user-row:hover, .state-row:hover, .quote-row:hover { border-color: rgba(67, 141, 215, 0.3); }
.card-locked { cursor: default; opacity: 0.85; }
.card-locked:hover { transform: none; box-shadow: none; }

.kpi-card {
  padding: 1.25rem 1.5rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(229, 229, 229, 0.7);
  backdrop-filter: blur(10px);
}
.kpi-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); font-weight: 600; }
.kpi-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 0.25rem; color: var(--color-primary-dark); }
.kpi-income .kpi-value, .kpi-net-pos .kpi-value, .kpi-accepted .kpi-value { color: #047857; }
.kpi-expense .kpi-value, .kpi-net-neg .kpi-value { color: #b91c1c; }

.mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.mini-kpis > div {
  min-width: 0;
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(229, 229, 229, 0.72);
}
.mini-kpis span {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mini-kpis strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--color-primary-dark);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; }
.quote-main { flex: 1; min-width: 0; text-align: left; cursor: pointer; }
.quote-amount, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.quote-amount { font-weight: 700; font-size: 1rem; color: var(--color-primary-dark); white-space: nowrap; }
.quote-status-form {
  flex: 0 0 auto;
  min-width: 9.5rem;
}
.quote-status-form .custom-select-button {
  min-height: 36px;
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.quote-status-form .custom-select-button::after {
  right: 0.75rem;
}
.ref-pill {
  display: inline-flex;
  padding: 0.2rem 0.5rem;
  background: rgba(67, 141, 215, 0.10);
  border: 1px solid rgba(67, 141, 215, 0.20);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--color-primary-dark);
}

.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.625rem; }
.folder-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  border-radius: 14px;
  cursor: pointer;
}
.folder-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(67, 141, 215, 0.10);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.875rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}
.crumb-current { color: var(--color-primary-dark); font-weight: 600; }
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  border-radius: 14px;
  border: 2px dashed rgba(67, 141, 215, 0.35);
  background: rgba(67, 141, 215, 0.04);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.upload-zone:hover { background: rgba(67, 141, 215, 0.08); border-color: var(--color-primary); }

.doc-row-rich {
  align-items: flex-start;
}
.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.doc-tags span {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.48rem;
  border-radius: 9999px;
  background: rgba(67, 141, 215, 0.08);
  border: 1px solid rgba(67, 141, 215, 0.18);
  color: var(--color-primary-dark);
  font-size: 0.72rem;
  font-weight: 700;
}

.event-widget-list {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.todo-block { display: flex; flex-direction: column; gap: 0.25rem; }
.todo-check {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(102, 102, 102, 0.4);
  border-radius: 6px;
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.todo-check-on { background: var(--color-primary); border-color: var(--color-primary); color: white; }
.todo-title { font-weight: 500; color: var(--color-primary-dark); }
.todo-done { opacity: 0.55; }
.todo-done .todo-title { text-decoration: line-through; }
.sub-list {
  margin-left: 1.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-left: 2px solid rgba(67, 141, 215, 0.20);
  padding-left: 0.875rem;
  padding-top: 0.25rem;
}
.sub-row { background: rgba(255, 255, 255, 0.45); }
.sub-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1.625rem;
  padding: 0.5rem 0 0.5rem 0.875rem;
  border-left: 2px solid rgba(67, 141, 215, 0.20);
}
.due-badge { background: rgba(67, 141, 215, 0.10); color: var(--color-primary-dark); border: 1px solid rgba(67, 141, 215, 0.20); }
.due-overdue { background: rgba(239, 68, 68, 0.10); color: #dc2626; border-color: rgba(239, 68, 68, 0.30); }
.due-today { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.30); }

.comms-list, .timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.comms-list::before, .timeline::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(to bottom, rgba(67, 141, 215, 0.30), rgba(67, 141, 215, 0.05));
}
.timeline::before { left: 15px; top: 12px; bottom: 12px; }
.comm-item, .timeline-item { position: relative; display: flex; gap: 1rem; padding-bottom: 1.25rem; }
.comm-item:last-child, .timeline-item:last-child { padding-bottom: 0; }
.comm-marker, .timeline-dot {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 2px solid;
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}
.timeline-dot { width: 32px; height: 32px; border-color: rgba(67, 141, 215, 0.4); color: var(--color-primary); }
.comm-body, .timeline-content {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(229, 229, 229, 0.7);
  border-radius: 14px;
}
.timeline-content { padding: 0.625rem 0.875rem; border-radius: 12px; }
.outcome {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.20);
  border-radius: 10px;
}

.calendar-shell .fc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.fc-toolbar-title { font-size: 1.4rem; font-weight: 700; color: var(--color-primary-dark); letter-spacing: -0.02em; }
.fc-button {
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(229, 229, 229, 0.7);
  color: var(--color-primary-dark);
}
.fc-button-active { background: var(--color-primary); border-color: var(--color-primary); color: white; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); border-top: 1px solid rgba(229, 229, 229, 0.6); border-left: 1px solid rgba(229, 229, 229, 0.6); overflow: auto; }
.calendar-head, .calendar-day {
  min-height: 42px;
  border-right: 1px solid rgba(229, 229, 229, 0.6);
  border-bottom: 1px solid rgba(229, 229, 229, 0.6);
  background: rgba(255,255,255,0.45);
}
.calendar-head { padding: 0.5rem; color: var(--color-text-muted); font-size: 0.875rem; font-weight: 600; text-align: center; }
.calendar-day { min-height: 112px; padding: 0.4rem; }
.calendar-day-muted { opacity: 0.45; }
.calendar-date { color: var(--color-primary-dark); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 9999px; }
.calendar-today .calendar-date { background: var(--color-primary); color: white; }
.calendar-event {
  display: block;
  margin-top: 0.25rem;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .calendar-shell .fc-toolbar { flex-direction: column; align-items: stretch; }
  .fc-toolbar-title { text-align: center; font-size: 1.1rem; }
  .calendar-grid { grid-template-columns: repeat(7, minmax(70px, 1fr)); }
  .calendar-day { min-height: 92px; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
}
.modal-backdrop.is-open { display: flex; }
.modal-panel {
  width: min(100%, 620px);
  max-height: min(82vh, 760px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
}
.modal-panel-sm { width: min(100%, 440px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; flex-wrap: wrap; }

.empty-state {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--color-text-muted);
}
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(67, 141, 215, 0.10);
  color: var(--color-primary);
}
.error-banner, .success-banner, .info-banner, .closer-banner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border-radius: 12px;
  font-size: 0.9rem;
}
.error-banner { background: rgba(239, 68, 68, 0.08); color: #b91c1c; border: 1px solid rgba(239, 68, 68, 0.25); }
.success-banner { background: rgba(16, 185, 129, 0.08); color: #047857; border: 1px solid rgba(16, 185, 129, 0.25); }
.info-banner { background: rgba(67, 141, 215, 0.08); color: var(--color-primary-dark); border: 1px solid rgba(67, 141, 215, 0.20); }
.closer-banner { align-items: flex-start; background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.25); color: #92400e; }

.role-grid { display: grid; gap: 0.75rem; }
.role-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.625rem;
  padding: 0.875rem;
  border: 2px solid var(--color-border);
  border-radius: 14px;
  background: white;
  cursor: pointer;
}
.role-card-active { border-color: var(--color-primary); background: rgba(67, 141, 215, 0.06); }
.role-dot { width: 12px; height: 12px; border-radius: 9999px; margin-top: 0.25rem; }
.role-name { font-weight: 700; color: var(--color-primary-dark); }
.role-desc { grid-column: 2; color: var(--color-text-muted); font-size: 0.8125rem; line-height: 1.35; }
.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.16s var(--ease), border-color 0.16s ease;
}
.color-swatch:hover, .color-swatch-active { transform: scale(1.06); border-color: var(--color-primary-dark); }

.amount-row { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; gap: 1rem; }
.amount-label { color: var(--color-text-muted); }
.amount-value { font-weight: 600; }
.amount-row.final { border-top: 1px solid rgba(229, 229, 229, 0.7); margin-top: 0.5rem; padding-top: 1rem; }
.mod-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px dashed rgba(229, 229, 229, 0.6);
}

.state-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.35rem;
  border-radius: 9999px;
  cursor: pointer;
}
.state-trigger:hover { background: rgba(67, 141, 215, 0.08); }
.state-dropdown {
  position: relative;
  z-index: 70;
}
.state-dropdown.is-open {
  z-index: 10020;
}
.state-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  display: none;
  min-width: 17rem;
  padding: 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-glass-lg);
  z-index: 10030;
}
.state-dropdown.is-open .state-menu {
  display: grid;
  gap: 0.35rem;
}
.state-list { display: grid; gap: 0.5rem; }
.state-row-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: white;
  cursor: pointer;
}
.state-row-btn:hover, .state-row-active { background: rgba(67, 141, 215, 0.07); border-color: rgba(67, 141, 215, 0.35); }
.state-dot { width: 12px; height: 12px; border-radius: 9999px; flex-shrink: 0; }

.code-wrap { display: inline-flex; align-items: center; gap: 0.25rem; }
.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.625rem;
  border-radius: 8px;
  background: rgba(67, 141, 215, 0.08);
  border: 1px solid rgba(67, 141, 215, 0.20);
  color: var(--color-primary-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.code-pill:hover { background: rgba(67, 141, 215, 0.14); border-color: rgba(67, 141, 215, 0.35); }
.code-text { user-select: all; }
.code-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
}
.code-edit:hover { background: rgba(67, 141, 215, 0.10); color: var(--color-primary-dark); }
.code-input, .danger-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.code-input { font-size: 1.35rem; font-weight: 700; text-align: center; }
.code-input-small { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.entity-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.20);
}
.upload-zone-active { background: rgba(67, 141, 215, 0.12); border-color: var(--color-primary); }

.note-surface {
  max-width: 58rem;
}
.note-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
  padding: 0.5rem;
  border: 1px solid rgba(229, 229, 229, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
}
.note-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.7rem;
  border-radius: 9px;
  color: var(--color-text-muted);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}
.note-toolbar button:hover {
  background: rgba(67, 141, 215, 0.10);
  color: var(--color-primary-dark);
}
.note-editor {
  min-height: 420px;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--color-text);
  caret-color: var(--color-primary-dark);
  cursor: text;
  line-height: 1.65;
  outline: none;
  overflow-wrap: anywhere;
  white-space: normal;
}
.note-editor:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(67, 141, 215, 0.12);
}
.note-editor h2,
.note-editor h3 {
  margin: 1rem 0 0.45rem;
  color: var(--color-primary-dark);
  letter-spacing: 0;
}
.note-editor p {
  min-height: 1.65em;
  margin: 0.35rem 0;
}
.note-editor ul,
.note-editor ol {
  padding-left: 1.4rem;
  margin: 0.5rem 0;
}
.note-editor blockquote {
  margin: 0.75rem 0;
  padding: 0.55rem 0.85rem;
  border-left: 3px solid var(--color-primary);
  background: rgba(67, 141, 215, 0.06);
  color: var(--color-text-muted);
}
.note-task {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.28rem 0;
  padding: 0.18rem 0.25rem;
  border-radius: 8px;
  color: var(--color-primary-dark);
  font-weight: 600;
  line-height: 1.55;
}
.note-task:focus-within {
  background: rgba(67, 141, 215, 0.06);
}
.note-task input {
  margin-top: 0.3rem;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.note-task span {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 1.55em;
  outline: none;
  overflow-wrap: anywhere;
}
.note-save-state {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  background: rgba(67, 141, 215, 0.08);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.note-save-state[data-tone="ok"] {
  background: rgba(16, 185, 129, 0.10);
  color: #047857;
}
.note-save-state[data-tone="error"] {
  background: rgba(239, 68, 68, 0.10);
  color: #b91c1c;
}

.devis-editor { display: flex; flex-direction: column; min-height: 100vh; margin: -1.25rem; }
.editor-toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  background: rgba(250, 250, 250, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
}
.editor-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.25rem;
  padding: 1.25rem;
}
.editor-form {
  padding: 1.25rem;
  align-self: start;
  position: sticky;
  top: 4.5rem;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
}
.form-group { margin-bottom: 0.75rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.75rem; }
.form-group:last-child { border-bottom: none; padding-bottom: 0; }
.form-group summary {
  font-weight: 700;
  color: var(--color-primary-dark);
  cursor: pointer;
  padding: 0.5rem 0;
  list-style: none;
}
.form-group summary::before { content: "▸"; color: var(--color-text-muted); display: inline-block; margin-right: 0.45rem; transition: transform 0.18s ease; }
.form-group[open] > summary::before { transform: rotate(90deg); }
.offer-btn {
  display: block;
  padding: 0.625rem 0.5rem;
  border-radius: 10px;
  border: 2px solid var(--color-border);
  background: white;
  cursor: pointer;
  text-align: center;
}
.offer-btn:hover { border-color: rgba(67, 141, 215, 0.4); }
.offer-btn-active { border-color: var(--color-primary); background: rgba(67, 141, 215, 0.08); }
.offer-label { display: block; font-weight: 600; font-size: 0.85rem; color: var(--color-primary-dark); }
.offer-price { display: block; font-size: 0.7rem; color: var(--color-text-muted); margin-top: 0.2rem; }
.line-card {
  padding: 0.875rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--color-border);
}
.line-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.75rem; }
.line-top strong { color: var(--color-primary-dark); }
.locked-meta { color: var(--color-text-muted); font-size: 0.78rem; line-height: 1.45; margin-top: 0.2rem; }
.pill { display: inline-flex; border: 1px solid var(--color-border); background: var(--color-bg-soft); border-radius: 999px; padding: 0.25rem 0.5rem; font-size: 0.7rem; color: var(--color-text-muted); font-weight: 700; white-space: nowrap; }
.editor-preview { display: flex; justify-content: center; padding: 1rem 0; overflow-x: auto; }

.devis-pages {
  --devis-navy: #0F2A47;
  --devis-blue: #1E95E6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  color: #1F2937;
  font-family: Georgia, "Times New Roman", serif;
}
.devis-page {
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  padding: 17mm 18mm 14mm;
  background: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(15, 42, 71, 0.16);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
  page-break-after: always;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10pt;
  line-height: 1.45;
}
.devis-page::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(var(--devis-navy), var(--devis-blue)); }
.devis-page::after { content: ""; position: absolute; right: -35mm; top: -35mm; width: 90mm; height: 90mm; border-radius: 50%; background: radial-gradient(circle, rgba(30, 149, 230, .13), rgba(30, 149, 230, 0) 68%); pointer-events: none; }
.devis-pages .page-content { flex: 1; min-height: 0; overflow: hidden; padding-top: 0; }
.devis-pages .doc-header { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: start; padding-bottom: 12px; border-bottom: 1px solid rgba(15, 42, 71, 0.12); flex: 0 0 auto; }
.devis-pages .doc-header.compact { padding-bottom: 10px; }
.devis-pages .brand { display: flex; gap: 12px; align-items: center; }
.devis-pages .brand-logo { height: 42px; width: auto; max-width: 64mm; object-fit: contain; }
.devis-pages .brand-name { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 20pt; line-height: 1; letter-spacing: 0; white-space: nowrap; color: #1f2937; }
.devis-pages .brand-tag, .devis-pages .doc-type, .devis-pages .doc-date, .devis-pages .label, .devis-pages .doc-footer, .devis-pages .money, .devis-pages .legal-meta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.devis-pages .brand-tag { font-size: 7.5pt; letter-spacing: .18em; text-transform: uppercase; color: #6b7280; margin-top: 6px; }
.devis-pages .doc-meta { text-align: right; }
.devis-pages .doc-type { font-size: 7.5pt; letter-spacing: .2em; text-transform: uppercase; color: #6b7280; margin-bottom: 6px; }
.devis-pages .doc-number { font-family: Georgia, "Times New Roman", serif; font-size: 26pt; line-height: 1; color: #1f2937; }
.devis-pages .doc-number span { color: var(--devis-blue); }
.devis-pages .compact .doc-number { font-size: 16pt; }
.devis-pages .doc-date { margin-top: 10px; font-size: 8pt; color: #52616f; letter-spacing: .04em; line-height: 1.5; }
.devis-pages .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 14px 0 16px; border-bottom: 1px solid rgba(15, 42, 71, 0.12); }
.devis-pages .label { font-size: 7.5pt; letter-spacing: .18em; text-transform: uppercase; color: #6b7280; margin-bottom: 8px; }
.devis-pages .party { font-size: 10pt; line-height: 1.55; color: #1f2937; }
.devis-pages .party strong { font-weight: 500; }
.devis-pages .intro { padding: 12px 0 4px; }
.devis-pages .eyebrow { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 7.5pt; letter-spacing: .18em; text-transform: uppercase; color: var(--devis-blue); margin-bottom: 8px; }
.devis-pages .intro h2, .devis-pages .page-title { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 22pt; line-height: 1.05; letter-spacing: 0; margin: 0 0 6px; color: #1f2937; }
.devis-pages .intro h2 em, .devis-pages .page-title em { font-style: normal; color: var(--devis-blue); }
.devis-pages .intro p { margin: 0; max-width: 160mm; color: #52616f; font-size: 10pt; line-height: 1.55; }
.devis-pages .page-title { margin: 0 0 18px; font-size: 24pt; }
.devis-pages .section-spacer { height: 13px; }
.devis-pages table.items { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 9.5pt; }
.devis-pages table.items th { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 7.5pt; letter-spacing: .14em; text-transform: uppercase; color: #6b7280; font-weight: 500; text-align: left; padding: 10px; border-bottom: 1.5px solid var(--devis-navy); }
.devis-pages table.items th.num, .devis-pages table.items td.num { text-align: right; font-variant-numeric: tabular-nums; }
.devis-pages table.items td { padding: 10px; border-bottom: 1px solid rgba(15, 42, 71, 0.12); vertical-align: top; }
.devis-pages .item-title { font-weight: 500; color: #1f2937; font-size: 10pt; margin-bottom: 3px; }
.devis-pages .item-desc { color: #52616f; font-size: 8.5pt; line-height: 1.42; max-width: 80mm; }
.devis-pages .money { font-size: 9pt; }
.devis-pages .totals { margin-top: 12px; margin-left: auto; width: 86mm; border: 1px solid rgba(15, 42, 71, 0.12); background: #f7fafc; padding: 12px 16px; }
.devis-pages .total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 9pt; color: #52616f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.devis-pages .total-row.grand { border-top: 1.5px solid var(--devis-navy); margin-top: 8px; padding-top: 10px; color: #1f2937; font-family: Georgia, "Times New Roman", serif; font-weight: 600; font-size: 11.5pt; }
.devis-pages .conditions { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 12px; }
.devis-pages .conditions h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 15pt; line-height: 1; margin: 0 0 10px; color: #1f2937; }
.devis-pages .conditions p { margin: 0 0 8px; color: #52616f; font-size: 9.5pt; line-height: 1.55; }
.devis-pages .conditions ul { margin: 0; padding: 0; list-style: none; }
.devis-pages .conditions li { font-size: 9.5pt; line-height: 1.55; color: #52616f; padding-left: 14px; position: relative; margin-bottom: 6px; }
.devis-pages .conditions li::before { content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 1px; background: var(--devis-navy); }
.devis-pages .next { margin-top: 20px; padding: 18px 20px; border: 1px solid rgba(15, 42, 71, 0.12); background: #f7fafc; }
.devis-pages .next ol { margin: 0; padding-left: 18px; color: #52616f; font-size: 9.5pt; line-height: 1.7; }
.devis-pages .sign-wrap { margin-top: 22px; }
.devis-pages .sign-intro { font-family: Georgia, "Times New Roman", serif; font-size: 13pt; line-height: 1.35; color: #1f2937; margin: 0 0 14px; }
.devis-pages .sign-intro small { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8pt; color: #6b7280; letter-spacing: .04em; margin-top: 4px; }
.devis-pages .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding-top: 18px; border-top: 1px solid rgba(15, 42, 71, 0.12); }
.devis-pages .who { font-size: 10pt; color: #1f2937; font-weight: 500; margin-bottom: 20px; }
.devis-pages .sign-names { display: block; margin-top: 6px; font-weight: 400; color: #52616f; line-height: 1.45; }
.devis-pages .sign-line { height: 1px; background: #1f2937; opacity: .25; margin-top: 30px; }
.devis-pages .client-blank-signature { font-weight: 400; color: #52616f; margin-bottom: 0; }
.devis-pages .client-blank-signature span { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8pt; color: #6b7280; letter-spacing: .04em; }
.devis-pages .client-blank-signature .name-line { margin-top: 18px; margin-bottom: 14px; }
.devis-pages .place { margin-top: 8px; font-size: 8.5pt; color: #6b7280; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.devis-pages .doc-footer { padding-top: 12px; border-top: 1px solid rgba(15, 42, 71, 0.12); display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; font-size: 7pt; letter-spacing: .06em; color: #6b7280; flex: 0 0 auto; }
.devis-pages .doc-footer .center { text-align: center; display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.devis-pages .doc-footer .right { text-align: right; }
.devis-pages .doc-footer strong { font-weight: 500; text-transform: uppercase; letter-spacing: .18em; color: #6b7280; margin-right: 6px; }
.devis-pages .preview-divider { width: 210mm; max-width: 100%; margin: 12px 0 0; padding: 10px 14px; border: 1px solid rgba(15, 42, 71, 0.12); border-radius: 14px; background: #fff; color: #52616f; font-size: 13px; font-weight: 700; }
.devis-pages .annex-cover { padding: 14px 0 12px; border-bottom: 1px solid rgba(15, 42, 71, 0.12); margin-bottom: 12px; }
.devis-pages .annex-kicker { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 7.5pt; letter-spacing: .18em; text-transform: uppercase; color: var(--devis-blue); margin-bottom: 8px; }
.devis-pages .annex-cover h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; font-size: 23pt; line-height: 1.05; margin: 0 0 8px; color: #1f2937; }
.devis-pages .annex-ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8pt; letter-spacing: .04em; color: #52616f; }
.devis-pages .legal-intro { font-size: 8.8pt; line-height: 1.45; color: #52616f; padding: 9px 11px; border: 1px solid rgba(15, 42, 71, 0.12); background: #f7fafc; margin: 0 0 8px; }
.devis-pages .legal-meta { font-size: 7.6pt; letter-spacing: .04em; color: #6b7280; margin: 0 0 8px; }
.devis-pages .legal-section { margin: 0 0 7px; padding: 8px 10px 8px 12px; border: 1px solid rgba(15, 42, 71, 0.12); border-left: 3px solid var(--devis-navy); background: #fff; }
.devis-pages .legal-section h2 { font-family: Georgia, "Times New Roman", serif; font-size: 10pt; line-height: 1.15; font-weight: 600; color: var(--devis-navy); margin: 0 0 5px; }
.devis-pages .legal-section p { font-size: 7.4pt; line-height: 1.25; color: #1f2937; white-space: pre-line; margin: 0; }
.devis-page-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid rgba(15, 42, 71, 0.12); padding-bottom: 10mm; gap: 1rem; }
.devis-brand { display: flex; gap: 0.75rem; align-items: center; }
.devis-brand-logo { height: 48px; width: auto; object-fit: contain; }
.devis-brand-name { font-size: 1.35rem; font-weight: 700; color: var(--devis-navy); }
.devis-brand-tag, .devis-meta, .devis-party-label, .devis-party-details, .devis-items-table, .devis-totals, .devis-clarity, .devis-next, .devis-signature, .devis-annex-sections { font-family: system-ui, sans-serif; }
.devis-brand-tag { font-size: 0.78rem; color: #6B7280; }
.devis-meta { text-align: right; }
.devis-meta-label, .devis-party-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: #6B7280; }
.devis-meta-ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 1.1rem; color: var(--devis-navy); margin-top: 0.25rem; }
.devis-meta-line { font-size: 0.78rem; color: #1F2937; margin-top: 0.4rem; }
.devis-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 18mm; }
.devis-party-name { font-size: 1.4rem; font-weight: 600; color: var(--devis-navy); margin-top: 0.4rem; }
.devis-party-details { font-size: 0.85rem; color: #1F2937; line-height: 1.55; margin-top: 0.5rem; }
.devis-party-details a { color: var(--devis-blue); text-decoration: none; }
.devis-intro-eyebrow { font-family: system-ui, sans-serif; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--devis-blue); }
.devis-intro-title { font-size: 2.2rem; font-weight: 600; color: var(--devis-navy); line-height: 1.15; margin-top: 0.4rem; }
.devis-intro-title span { color: var(--devis-blue); font-style: italic; }
.devis-intro-paragraph { font-family: system-ui, sans-serif; font-size: 0.92rem; line-height: 1.6; margin-top: 0.75rem; max-width: 60ch; }
.devis-items-table { width: 100%; border-collapse: collapse; }
.devis-items-table th { text-align: left; padding: 0.75rem 0.5rem; border-bottom: 2px solid var(--devis-navy); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--devis-navy); }
.devis-items-table td { padding: 0.875rem 0.5rem; border-bottom: 1px solid rgba(15, 42, 71, 0.08); vertical-align: top; }
.devis-items-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.devis-items-table .bold { font-weight: 700; color: var(--devis-navy); }
.devis-item-title { font-weight: 600; font-size: 0.95rem; color: var(--devis-navy); }
.devis-item-description { font-size: 0.8rem; color: #6B7280; margin-top: 0.25rem; line-height: 1.5; }
.devis-totals { display: flex; justify-content: flex-end; }
.devis-totals-grid { display: grid; gap: 0.4rem; min-width: 60mm; }
.devis-totals-grid > div { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem; }
.devis-totals-grid .grand { border-top: 2px solid var(--devis-navy); padding-top: 0.6rem; margin-top: 0.4rem; font-size: 1.15rem; font-weight: 700; color: var(--devis-navy); }
.devis-clarity { display: grid; gap: 1.5rem; }
.devis-clarity h3, .devis-next h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--devis-navy); margin-bottom: 0.5rem; }
.devis-clarity ul, .devis-next ol { padding-left: 1.25rem; font-size: 0.82rem; line-height: 1.65; }
.devis-clarity p { font-size: 0.82rem; line-height: 1.65; }
.devis-signature { margin-top: auto; }
.devis-signature p { font-size: 0.85rem; margin-bottom: 1rem; }
.devis-signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12mm; }
.devis-signature-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: #6B7280; }
.devis-signature-line { height: 24mm; border-bottom: 1px solid rgba(15, 42, 71, 0.4); margin-top: 0.6rem; }
.devis-signature-name { font-size: 0.9rem; font-weight: 600; color: var(--devis-navy); margin-top: 0.5rem; }
.devis-signature-date { font-size: 0.8rem; color: #6B7280; margin-top: 0.2rem; }
.devis-page-footer { display: flex; justify-content: space-between; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.7rem; color: #6B7280; border-top: 1px solid rgba(15, 42, 71, 0.10); padding-top: 6mm; }
.devis-annex-title { font-size: 1.6rem; font-weight: 600; color: var(--devis-navy); }
.devis-annex-subtitle { font-family: system-ui, sans-serif; font-size: 0.78rem; color: #6B7280; }
.devis-annex-sections { display: grid; gap: 1rem; font-size: 0.82rem; line-height: 1.6; }
.devis-annex-sections h2 { font-size: 0.92rem; font-weight: 700; color: var(--devis-navy); margin-bottom: 0.4rem; }
.devis-annex-sections h2 span { color: var(--devis-blue); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.print-shell { background: white; min-height: 100vh; padding: 1rem; }
.no-print { display: flex; }

@media (max-width: 1100px) {
  .editor-grid { grid-template-columns: 1fr; }
  .editor-form { position: static; max-height: none; }
}
@media (max-width: 900px) {
  .devis-page { width: 100%; height: auto; min-height: auto; padding: 1.5rem; }
  .devis-parties, .devis-signature-grid, .devis-pages .parties, .devis-pages .sign, .devis-pages .conditions { grid-template-columns: 1fr; }
}
@media print {
  body { background: white !important; }
  .no-print, .topbar, .sidebar, .bottom-nav { display: none !important; }
  .app-shell, .main-shell, .content { display: block !important; padding: 0 !important; margin: 0 !important; }
  .print-shell { padding: 0; }
  .devis-page { width: 100%; min-height: auto; box-shadow: none; border-radius: 0; margin: 0; page-break-after: always; }
  .devis-page:last-child { page-break-after: auto; }
}

/* Mini utility layer used by the PHP templates. */
.hidden { display: none !important; }
.block { display: block !important; }
.inline { display: inline !important; }
.inline-flex { display: inline-flex !important; }
.flex { display: flex !important; }
.grid { display: grid !important; }
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.items-baseline { align-items: baseline !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-end { justify-content: flex-end !important; }
.flex-col { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.min-w-0 { min-width: 0 !important; }
.w-full { width: 100% !important; }
.w-auto { width: auto !important; }
.h-10 { height: 2.5rem !important; }
.max-w-2xl { max-width: 42rem !important; }
.max-w-3xl { max-width: 48rem !important; }
.max-w-7xl { max-width: 80rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.ml-auto { margin-left: auto !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mt-5 { margin-top: 1.25rem !important; }
.mt-6 { margin-top: 1.5rem !important; }
.mt-8 { margin-top: 2rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.p-0 { padding: 0 !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1rem !important; }
.p-5 { padding: 1.25rem !important; }
.p-6 { padding: 1.5rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-6 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-12 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
.py-20 { padding-top: 5rem !important; padding-bottom: 5rem !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }
.gap-4 { gap: 1rem !important; }
.gap-5 { gap: 1.25rem !important; }
.gap-6 { gap: 1.5rem !important; }
.space-y-1 > * + * { margin-top: 0.25rem !important; }
.space-y-2 > * + * { margin-top: 0.5rem !important; }
.space-y-3 > * + * { margin-top: 0.75rem !important; }
.space-y-4 > * + * { margin-top: 1rem !important; }
.space-y-5 > * + * { margin-top: 1.25rem !important; }
.space-y-6 > * + * { margin-top: 1.5rem !important; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.col-span-2 { grid-column: span 2 / span 2 !important; }
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-xs { font-size: 0.75rem !important; }
.text-sm { font-size: 0.875rem !important; }
.text-base { font-size: 1rem !important; }
.text-lg { font-size: 1.125rem !important; }
.text-xl { font-size: 1.25rem !important; }
.text-2xl { font-size: 1.5rem !important; }
.text-3xl { font-size: 1.875rem !important; }
.text-4xl { font-size: 2.25rem !important; }
.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }
.uppercase { text-transform: uppercase !important; }
.italic { font-style: italic !important; }
.leading-none { line-height: 1 !important; }
.leading-relaxed { line-height: 1.625 !important; }
.tracking-wide { letter-spacing: 0.025em !important; }
.truncate { overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
.break-words { overflow-wrap: break-word !important; }
.whitespace-nowrap { white-space: nowrap !important; }
.whitespace-pre-wrap { white-space: pre-wrap !important; }
.resize-y { resize: vertical !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-x-auto { overflow-x: auto !important; }
.text-primary { color: var(--color-primary) !important; }
.text-primary-dark { color: var(--color-primary-dark) !important; }
.text-ink { color: var(--color-text) !important; }
.text-ink-muted { color: var(--color-text-muted) !important; }
.text-ink-subtle { color: var(--color-text-subtle) !important; }
.text-red-500 { color: #ef4444 !important; }
.text-red-600 { color: #dc2626 !important; }
.text-emerald-600 { color: #059669 !important; }
.text-emerald-700 { color: #047857 !important; }
.text-amber-600 { color: #d97706 !important; }
.text-amber-700 { color: #b45309 !important; }
.bg-white { background: white !important; }
.bg-amber-50 { background: #fffbeb !important; }
.bg-red-50 { background: #fef2f2 !important; }
.bg-emerald-50 { background: #ecfdf5 !important; }
.bg-gray-100 { background: #f3f4f6 !important; }
.text-gray-600 { color: #4b5563 !important; }
.border { border-width: 1px !important; border-style: solid !important; }
.border-amber-200 { border-color: #fde68a !important; }
.border-red-200 { border-color: #fecaca !important; }
.border-emerald-200 { border-color: #a7f3d0 !important; }
.border-gray-200 { border-color: #e5e7eb !important; }
.divide-y > * + * { border-top: 1px solid rgba(229, 229, 229, 0.7); }
.rounded-full { border-radius: 9999px !important; }
.cursor-pointer { cursor: pointer !important; }
.opacity-60 { opacity: 0.6 !important; }
.opacity-70 { opacity: 0.7 !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; border: 0 !important; }

@media (min-width: 768px) {
  .md\:hidden { display: none !important; }
  .md\:block { display: block !important; }
  .md\:flex { display: flex !important; }
  .md\:grid { display: grid !important; }
  .md\:inline-flex { display: inline-flex !important; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .md\:col-span-2 { grid-column: span 2 / span 2 !important; }
  .md\:text-3xl { font-size: 1.875rem !important; }
  .md\:text-4xl { font-size: 2.25rem !important; }
  .md\:p-4 { padding: 1rem !important; }
  .md\:p-5 { padding: 1.25rem !important; }
  .md\:p-6 { padding: 1.5rem !important; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (max-width: 767px) {
  .mobile-stack { flex-direction: column; align-items: stretch; }
  .quote-row { align-items: flex-start; flex-wrap: wrap; }
}
