@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f0f4fb;
  --card: #ffffff;
  --text: #11213d;
  --muted: #4f6386;
  --line: #d8e4f5;
  --primary: #2368c4;
  --primary-dark: #143e74;
  --danger: #cf2b4b;
  --ok: #1f9d55;
  --warn: #d18b1f;
  --radius: 18px;
  --shadow: 0 12px 28px rgba(17, 34, 66, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top left, #f7fbff 0, var(--bg) 58%);
  color: var(--text);
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

html {
  background: #eef4fc;
}

button,
input,
textarea,
select {
  font: inherit;
}

#app {
  min-height: 100dvh;
}

body.modal-open {
  overflow: hidden;
}

.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 20px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
  border: 1px solid #dae7f9;
}

.auth-brand {
  text-align: center;
  margin-bottom: 16px;
}

.auth-brand-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: 0 10px 18px rgba(17, 40, 73, 0.2);
}

.brand-title {
  margin: 10px 0 0;
  font-size: 22px;
  letter-spacing: 0.04em;
}

.brand-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
}

.form-row {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  font-size: 13px;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.08s ease, background 0.2s ease;
}

.btn:hover {
  background: #1d5aad;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.btn.secondary {
  background: #e7f0ff;
  color: #194b8c;
}

/* ===== Écrans de connexion — layout web split-screen ===== */
.auth-split {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}

.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  isolation: isolate;
  color: #fff;
}

.auth-aside-bg,
.auth-aside-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.auth-aside-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(150deg, rgba(8, 26, 52, 0.93) 0%, rgba(20, 62, 116, 0.84) 45%, rgba(35, 104, 196, 0.5) 100%);
}

.auth-aside-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(28px, 4vw, 60px);
  width: 100%;
}

.auth-aside-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
}

.auth-aside-brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}

.auth-aside-pitch h2 {
  font-size: clamp(30px, 3.3vw, 48px);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0 0 24px;
}

.auth-aside-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 13px;
}

.auth-aside-points li {
  position: relative;
  padding-left: 32px;
  font-size: 15.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.92);
}

.auth-aside-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 11px 11px no-repeat;
}

.auth-aside-foot {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
}

.auth-main {
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 56px);
  background: radial-gradient(circle at top right, #f7fbff 0, var(--bg) 62%);
}

.auth-main-inner {
  width: 100%;
  max-width: 420px;
  animation: authRise 0.5s ease both;
}

@keyframes authRise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.auth-main-inner > h2 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}

.auth-welcome-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 6px;
}

.link-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

@media (max-width: 880px) {
  .auth-split {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }
  .auth-aside {
    min-height: 188px;
  }
  .auth-aside-inner {
    justify-content: center;
    gap: 12px;
    padding: 22px 22px 24px;
  }
  .auth-aside-pitch,
  .auth-aside-foot {
    display: none;
  }
  .auth-main {
    padding: 26px 18px 44px;
  }
}

.btn.secondary:hover {
  background: #dbe9ff;
}

.btn.ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--danger);
}

.btn.ok {
  background: var(--ok);
}

.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.card {
  background: var(--card);
  border: 1px solid #dae7f9;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.hero {
  padding: 22px;
  border-radius: 26px;
  background: linear-gradient(135deg, #1f5ea9 0%, #0f2f58 100%);
  color: #fff;
}

.hero h2,
.hero h3,
.hero p {
  margin: 0;
}

.hero .kpi {
  font-size: 32px;
  font-weight: 800;
  margin: 12px 0;
}

.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.profile-hero-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.profile-hero-logo {
  flex: 0 0 auto;
}

.profile-logo-preview,
.profile-logo-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 20px;
}

.profile-logo-preview {
  display: block;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #fff;
}

.profile-logo-placeholder {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
}

.profile-logo-action {
  white-space: nowrap;
}

.finance-dashboard {
  display: grid;
  gap: 18px;
}

.finance-dashboard h2,
.finance-dashboard h3,
.finance-vat-head p {
  margin: 0;
}

.finance-dashboard-head,
.finance-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.finance-dashboard-head h2,
.finance-summary-head h3 {
  font-size: 18px;
  font-weight: 800;
}

.finance-summary-head span {
  color: var(--muted);
  font-size: 13px;
}

.finance-head-action {
  padding: 10px 14px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(35, 104, 196, 0.18);
}

.finance-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.finance-kpi-card {
  min-height: 180px;
  border-radius: 28px;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.finance-kpi-card.light {
  background: linear-gradient(145deg, #e7f1ff 0%, #dfe9ff 100%);
  box-shadow: 0 16px 30px rgba(28, 81, 154, 0.09);
}

.finance-kpi-card.dark {
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 18px 34px rgba(20, 62, 116, 0.24);
}

.finance-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
}

.finance-kpi-card.dark .finance-kpi-icon {
  background: rgba(255, 255, 255, 0.88);
  color: var(--primary);
}

.finance-kpi-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}

.finance-kpi-title {
  font-size: 15px;
  font-weight: 700;
  opacity: 0.9;
}

.finance-kpi-value {
  font-size: clamp(24px, 2.5vw, 36px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.finance-kpi-subtitle {
  font-size: 13px;
  opacity: 0.75;
}

.finance-net-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid #d9e5f6;
}

.finance-net-pill.is-positive .finance-net-icon {
  background: rgba(31, 157, 85, 0.12);
  color: var(--ok);
}

.finance-net-pill.is-negative .finance-net-icon {
  background: rgba(207, 43, 75, 0.12);
  color: var(--danger);
}

.finance-net-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
}

.finance-net-copy {
  display: grid;
  gap: 4px;
  flex: 1;
}

.finance-net-copy span {
  color: var(--muted);
  font-size: 13px;
}

.finance-net-copy strong {
  font-size: 16px;
}

.finance-net-meta {
  color: var(--muted);
  font-size: 13px;
}

.finance-inline-scans {
  display: grid;
  gap: 12px;
}

.finance-range-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.finance-range-tab {
  border: 1px solid #d8e4f5;
  background: #fff;
  color: var(--text);
  border-radius: 13px;
  padding: 10px 15px;
  font-weight: 800;
  cursor: pointer;
}

.finance-range-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.finance-chart-card {
  position: relative;
  border: 1px solid #d9e5f6;
  background: #fff;
  border-radius: 28px;
  padding: 14px 10px 12px 14px;
}

.finance-chart-svg-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 640 / 276;
}

.finance-chart-svg-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.finance-chart-grid {
  stroke: #d8e4f5;
  stroke-dasharray: 5 4;
  stroke-width: 1;
}

.finance-chart-axis,
.finance-chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.finance-chart-area-primary {
  fill: url(#finance-primary-fill);
}

.finance-chart-area-secondary {
  fill: url(#finance-secondary-fill);
}

.finance-chart-line-primary,
.finance-chart-line-secondary {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.finance-chart-line-primary {
  stroke: var(--primary);
}

.finance-chart-line-secondary {
  stroke: rgba(35, 104, 196, 0.36);
}

.finance-chart-bubble {
  fill: var(--primary);
  filter: drop-shadow(0 8px 16px rgba(35, 104, 196, 0.22));
}

.finance-chart-bubble-text {
  fill: #fff;
  font-size: 12px;
  font-weight: 800;
}

.finance-chart-dot {
  fill: var(--primary);
}

.finance-chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}

.finance-chart-interactions {
  position: absolute;
  inset: 0 46px 34px 0;
}

.finance-chart-hit-area {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.finance-chart-hit-area::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(35, 104, 196, 0);
  transform: translateX(-50%);
  transition: background 0.18s ease;
}

.finance-chart-hit-area:hover::after,
.finance-chart-hit-area.active::after {
  background: rgba(35, 104, 196, 0.18);
}

.finance-chart-detail {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(150deg, #f6faff 0%, #edf4ff 100%);
}

.finance-chart-detail-title {
  font-size: 14px;
  font-weight: 800;
}

.finance-chart-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.finance-chart-detail-grid div {
  display: grid;
  gap: 4px;
}

.finance-chart-detail-grid span {
  color: var(--muted);
  font-size: 12px;
}

.finance-chart-detail-grid strong {
  font-size: 14px;
}

.finance-chart-detail-grid strong.positive {
  color: var(--ok);
}

.finance-chart-detail-grid strong.negative {
  color: var(--danger);
}

.finance-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 5px;
  border-radius: 999px;
  background: #dce8fb;
}

.finance-toggle button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  border-radius: 999px;
  padding: 14px 16px;
  cursor: pointer;
}

.finance-toggle button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 20px rgba(35, 104, 196, 0.2);
}

.finance-insight {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 24px;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 20px 36px rgba(20, 62, 116, 0.22);
}

.finance-ring {
  --progress: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: conic-gradient(#fff calc(var(--progress) * 1turn), rgba(255, 255, 255, 0.18) 0);
  display: grid;
  place-items: center;
  position: relative;
  flex: 0 0 auto;
}

.finance-ring::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: rgba(20, 62, 116, 0.82);
}

.finance-ring span {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 800;
}

.finance-insight-copy {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.finance-insight-arrow {
  font-size: 28px;
  line-height: 1;
}

.finance-vat-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid #d9e5f6;
}

.finance-vat-head {
  display: grid;
  gap: 6px;
}

.finance-vat-head h3 {
  font-size: 18px;
  font-weight: 800;
}

.finance-vat-head p {
  color: var(--muted);
  font-size: 13px;
}

.finance-vat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.finance-vat-cell {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(150deg, #f6faff 0%, #edf4ff 100%);
}

.finance-vat-cell span {
  color: var(--muted);
  font-size: 13px;
}

.finance-vat-cell strong {
  font-size: 16px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row.between {
  justify-content: space-between;
}

.stack {
  display: grid;
  gap: 14px;
}

.shell {
  display: grid;
  gap: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(240, 244, 251, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #d8e4f5;
  transition: transform 0.24s ease, opacity 0.2s ease;
  will-change: transform;
}

.topbar.is-hidden {
  transform: translateY(-105%);
  opacity: 0.02;
}

.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 20px 10px;
  display: grid;
  gap: 10px;
}

.topbar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.topbar-actions-main {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-actions-side {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-inline img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.top-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.top-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.top-tabs button.active {
  background: #e8f1ff;
  color: #1a4f94;
  border-color: #b9d2f3;
}

.top-tab-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d62939;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.warn {
  color: #fff;
  background: var(--warn);
}

.badge.err {
  color: #fff;
  background: var(--danger);
}

.badge.ok {
  color: #fff;
  background: var(--ok);
}

.hero-chat-cta {
  border: 1px solid rgba(255, 255, 255, 0.44);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

.hero-chat-cta.has-unread {
  background: #d62939;
  border-color: rgba(255, 255, 255, 0.35);
}

.install-banner {
  border: 1px solid #c8d9f4;
  background: linear-gradient(170deg, #f8fbff 0%, #edf4ff 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.install-banner-copy {
  display: grid;
  gap: 4px;
}

.install-banner-copy strong {
  font-size: 14px;
}

.install-banner-copy span {
  color: var(--muted);
  font-size: 13px;
}

.install-banner-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.upload-cta {
  display: grid;
  gap: 12px;
  border: 2px dashed #b5cbed;
  border-radius: 16px;
  padding: 22px;
  background: linear-gradient(160deg, #f8fbff 0%, #eef4fd 100%);
}

.upload-cta h3,
.upload-cta p {
  margin: 0;
}

.upload-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: inline-grid;
  place-items: center;
  background: #dbe9fc;
  color: #1a4f94;
  font-size: 26px;
  font-weight: 800;
}

.upload-hint {
  color: var(--muted);
  font-size: 14px;
}

.invoice-list,
.message-list {
  display: grid;
  gap: 10px;
}

.invoice-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
}

.invoice-item.pending {
  border-style: dashed;
  cursor: default;
}

.invoice-item .title {
  font-weight: 800;
  margin-bottom: 4px;
}

.invoice-item .meta {
  color: var(--muted);
  font-size: 13px;
}

.invoice-item .amount {
  font-weight: 800;
  margin-top: 6px;
}

.invoice-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.generated-invoice-item {
  display: grid;
  gap: 8px;
}

.generated-invoice-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.generated-invoice-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.generated-invoice-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.generated-invoice-title-row .title {
  min-width: 0;
  flex: 1 1 auto;
}

.generated-invoice-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  justify-content: flex-start;
  flex-direction: column;
}

.generated-invoice-status-badge-inline {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.generated-invoice-actions-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.generated-invoice-more {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #8a95a8;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.generated-invoice-more:hover {
  background: rgba(35, 104, 196, 0.08);
  color: var(--primary);
}

.generated-invoice-deadline {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 74px;
}

.generated-invoice-deadline-value {
  color: var(--primary);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.generated-invoice-deadline-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}

.generated-invoice-deadline.is-overdue .generated-invoice-deadline-value,
.generated-invoice-deadline.is-overdue .generated-invoice-deadline-label {
  color: var(--danger);
}

.generated-invoice-paid-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(31, 157, 85, 0.12);
  color: #177346;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.generated-invoice-submeta {
  margin-top: -2px;
}

.generated-invoice-payment-summary {
  margin-top: 2px;
  color: var(--ok);
  font-weight: 700;
}

.generated-invoice-delivery-summary {
  margin-top: 2px;
  color: var(--primary);
  font-weight: 700;
}

.generated-invoice-delivery-summary.is-muted {
  color: var(--muted);
}

.generated-invoice-sent-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(31, 134, 95, 0.12);
  color: #136746;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.generated-invoice-viewed-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(35, 104, 196, 0.12);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.generated-invoice-overlay-footnote {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.generated-invoice-modal {
  width: min(92vw, 640px);
}

.generated-invoice-actions-modal {
  width: min(92vw, 560px);
}

.generated-invoice-action-row {
  width: 100%;
  border: 1px solid #d8e4f5;
  border-radius: 16px;
  background: #fff;
  padding: 14px 16px;
  text-align: left;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.generated-invoice-action-row strong {
  font-size: 15px;
}

.generated-invoice-action-row span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.generated-invoice-action-row:hover {
  border-color: rgba(35, 104, 196, 0.28);
  background: #f8fbff;
}

.generated-invoice-action-row:disabled {
  cursor: not-allowed;
  background: #f6f8fc;
  color: #8290a9;
  border-color: #dfe6f4;
}

.generated-invoice-action-row:disabled span {
  color: #8290a9;
}

.generated-invoice-payment-inline-summary {
  color: var(--ok);
  font-weight: 700;
}

.generated-invoice-quick-fill {
  width: auto;
}

.generated-invoice-payments-summary {
  border: 1px solid #dce7f7;
  border-radius: 16px;
  background: #f5f8fd;
  padding: 14px;
}

.generated-invoice-payments-list {
  display: grid;
  gap: 10px;
}

.generated-invoice-payment-row {
  border: 1px solid #dce7f7;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.invoice-builder-payment-terms {
  margin-top: -4px;
}

.invoice-builder-payment-terms.is-invalid {
  color: var(--danger);
  font-weight: 700;
}

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
}

.message-row {
  display: flex;
}

.message-bubble {
  max-width: 74%;
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.message-row.me {
  justify-content: flex-end;
}

.message-row.me .message-bubble {
  background: #1f5ea9;
  color: #fff;
  border: 0;
}

.message-meta {
  font-size: 11px;
  margin-top: 6px;
  opacity: 0.75;
}

.message-attachment {
  margin-top: 8px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.message-attachment img {
  display: block;
  width: 100%;
  max-width: 290px;
  height: auto;
}

.chat-input {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
}

.notice {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}

.notice.error {
  background: rgba(207, 43, 75, 0.12);
  border-color: rgba(207, 43, 75, 0.3);
  color: #7b1f32;
}

.notice.ok {
  background: rgba(31, 157, 85, 0.14);
  border-color: rgba(31, 157, 85, 0.3);
  color: #166a3c;
}

.kv {
  display: grid;
  gap: 10px;
}

.kv .row {
  justify-content: space-between;
  align-items: flex-start;
}

.kv .row > span:first-child {
  color: var(--muted);
}

.profile-save-row {
  margin-top: 4px;
}

.profile-save-row .btn {
  width: 100%;
}

.pdf-frame {
  width: 100%;
  min-height: 62vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.invoice-builder-page {
  display: grid;
  gap: 18px;
}

.invoice-builder-headline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 2px 0;
}

.invoice-builder-headline h2,
.invoice-builder-headline p {
  margin: 0;
}

.invoice-builder-headline h2 {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.invoice-builder-headline p {
  margin-top: 8px;
  max-width: 760px;
  color: var(--muted);
}

.invoice-builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.invoice-builder-main,
.invoice-builder-side {
  display: grid;
  gap: 16px;
}

.invoice-builder-side {
  align-self: start;
}

.invoice-builder-summary-anchor {
  position: relative;
}

.invoice-builder-summary-card {
  align-self: start;
}

.invoice-builder-summary-card.is-floating {
  position: fixed;
  z-index: 18;
  max-height: calc(100vh - 112px);
  overflow: auto;
}

.invoice-builder-logo-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.invoice-builder-logo-preview,
.invoice-builder-logo-placeholder {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  flex: 0 0 auto;
}

.invoice-builder-logo-preview {
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
}

.invoice-builder-logo-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #dbe9fd 0%, #eef4ff 100%);
  color: #1f5ea9;
  font-weight: 800;
}

.invoice-builder-address-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(120px, 1fr);
  gap: 12px;
}

.invoice-builder-location-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr) minmax(100px, 1fr);
  gap: 12px;
}

.invoice-builder-library {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #fbfdff 0%, #f2f7ff 100%);
}

.invoice-builder-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.invoice-builder-library-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

.invoice-builder-library-card[hidden] {
  display: none;
}

.invoice-builder-library-title {
  font-weight: 800;
}

.invoice-builder-library-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.invoice-builder-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(160deg, #eef5ff 0%, #f7fbff 100%);
  border: 1px solid #cfe0f7;
}

.invoice-builder-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.invoice-builder-item-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.invoice-builder-item-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: #fbfdff;
  border: 1px solid var(--line);
}

.invoice-builder-item-title {
  font-size: 16px;
  font-weight: 800;
}

.invoice-builder-item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.invoice-builder-item-description {
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.45;
}

.invoice-builder-item-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.invoice-builder-item-total span {
  color: var(--muted);
}

.invoice-builder-item-total strong {
  font-size: 16px;
}

@media (max-width: 980px) {
  .invoice-builder-layout {
    grid-template-columns: 1fr;
  }
}

.thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  flex: 0 0 auto;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.active {
  border-color: var(--primary);
}

.center {
  text-align: center;
}

#toast-root {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  display: grid;
  gap: 8px;
  width: min(92vw, 640px);
  z-index: 40;
  pointer-events: none;
}

.toast {
  width: 100%;
  background: #f8fbff;
  border: 1px solid #c8daf5;
  box-shadow: var(--shadow);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 15px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  pointer-events: auto;
}

.toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: #dfe9f9;
}

.toast-title {
  font-weight: 800;
  line-height: 1.24;
}

.toast-detail {
  margin-top: 4px;
  color: #4d6288;
  font-size: 13px;
}

.toast.toast-success {
  background: #f1fbf5;
  border-color: #bbe8c9;
}

.toast.toast-success .toast-icon {
  background: #d5f2df;
}

.toast.toast-error {
  background: #fff4f6;
  border-color: rgba(207, 43, 75, 0.3);
}

.toast.toast-error .toast-icon {
  background: #ffd8e0;
}

.toast.toast-warn {
  background: #fff9ef;
  border-color: #ebd39e;
}

.toast.toast-warn .toast-icon {
  background: #f6e5bd;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(10, 22, 41, 0.45);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(92vw, 620px);
  max-height: min(84vh, 760px);
  overflow: auto;
  background: #fff;
  border: 1px solid #d2e1f8;
  border-radius: 18px;
  box-shadow: 0 24px 56px rgba(10, 22, 41, 0.25);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.invoice-email-template-modal {
  width: min(92vw, 760px);
}

.invoice-email-editor {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  cursor: text;
}

.invoice-email-editor:focus {
  border-color: #6a5cff;
  box-shadow: 0 0 0 3px rgba(106, 92, 255, 0.12);
}

.invoice-email-editor:empty::before {
  content: attr(data-placeholder);
  color: #7e8ea9;
}

.invoice-email-editor-subject {
  min-height: 50px;
}

.invoice-email-editor-body {
  min-height: 210px;
}

.invoice-email-editor-chip,
.invoice-email-inline-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 2px 2px;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(96, 76, 255, 0.1);
  color: #5547eb;
  border: 1px solid rgba(96, 76, 255, 0.22);
  font-weight: 700;
  line-height: 1.2;
  vertical-align: baseline;
}

.invoice-email-editor-chip {
  user-select: none;
}

.invoice-email-token-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.invoice-email-token {
  appearance: none;
  border: 1px solid rgba(96, 76, 255, 0.34);
  border-radius: 999px;
  background: rgba(96, 76, 255, 0.08);
  color: #5547eb;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
}

.invoice-email-token:hover {
  background: rgba(96, 76, 255, 0.14);
}

.invoice-email-template-preview {
  display: grid;
  gap: 6px;
}

.invoice-email-template-preview strong {
  font-size: 13px;
}

.invoice-email-template-preview div {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  line-height: 1.6;
}

.modal-pdf-frame {
  width: 100%;
  min-height: 44vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.install-modal {
  width: min(92vw, 560px);
}

.install-qr-wrap {
  background: #fff;
  border: 1px dashed #c7d8f2;
  border-radius: 14px;
  display: grid;
  place-items: center;
  padding: 12px;
}

.install-qr-image {
  width: min(100%, 260px);
  height: auto;
  border-radius: 10px;
  border: 1px solid #d9e6fa;
  background: #fff;
}

.install-link-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.welcome-page {
  min-height: 100vh;
  position: relative;
  display: grid;
  overflow: hidden;
}

.welcome-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.welcome-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 34, 68, 0.2) 8%,
    rgba(32, 107, 178, 0.2) 44%,
    rgba(34, 87, 177, 0.33) 70%,
    rgba(48, 63, 112, 0.56) 100%
  );
}

.welcome-content {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 20px;
}

.welcome-top-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.welcome-top-left img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
}

.welcome-top-left span {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.welcome-brand {
  align-self: center;
  text-align: center;
  color: #fff;
}

.welcome-brand img {
  width: min(320px, 62vw);
  max-width: 100%;
  height: auto;
}

.welcome-brand h1 {
  margin: 14px 0 0;
  font-size: clamp(42px, 7vw, 70px);
  font-weight: 800;
}

.welcome-brand p {
  margin: 14px 0 0;
  font-size: clamp(21px, 3.5vw, 30px);
  line-height: 1.26;
  font-weight: 500;
}

.welcome-action {
  width: 100%;
  max-width: 560px;
  justify-self: center;
  margin-bottom: 10px;
}

.welcome-action .welcome-login-btn {
  width: 100%;
  min-height: 62px;
  border-radius: 999px;
  border: 2px solid rgba(219, 243, 255, 0.55);
  background: rgba(37, 113, 184, 0.32);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}

.welcome-action .welcome-login-btn:hover {
  background: rgba(37, 113, 184, 0.45);
}

@media (max-width: 760px) {
  .form-grid.cols-2,
  .filters {
    grid-template-columns: 1fr;
  }

  .invoice-builder-layout,
  .invoice-builder-item-grid,
  .invoice-builder-address-grid,
  .invoice-builder-location-grid {
    grid-template-columns: 1fr;
  }

  .invoice-builder-summary-card {
    max-height: none;
    overflow: visible;
  }

  .invoice-builder-summary-card.is-floating {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .invoice-builder-side {
    align-self: auto;
  }

  .invoice-builder-headline,
  .invoice-builder-library-card,
  .invoice-builder-editor-head,
  .generated-invoice-head,
  .profile-hero,
  .profile-hero-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .finance-dashboard-head,
  .finance-summary-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .finance-net-pill {
    flex-direction: column;
    align-items: flex-start;
  }

  .finance-insight {
    grid-template-columns: 1fr;
  }

  .finance-kpis,
  .finance-chart-detail-grid,
  .finance-vat-grid {
    grid-template-columns: 1fr;
  }

  .finance-insight-arrow {
    display: none;
  }

  .message-bubble {
    max-width: 88%;
  }

  .topbar-inner,
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-items: stretch;
  }

  .topbar-actions-main,
  .topbar-actions-side {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-actions .btn {
    width: auto;
  }

  .top-tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .top-tabs button {
    flex: 0 0 auto;
  }

  .generated-invoice-actions {
    width: 100%;
    align-items: flex-start;
  }

  .generated-invoice-actions-inline {
    justify-content: flex-start;
  }

  .generated-invoice-deadline {
    align-items: flex-start;
  }

  .welcome-top-left span {
    display: none;
  }

  .install-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .install-banner-actions {
    justify-content: flex-start;
  }

  .install-link-row {
    grid-template-columns: 1fr;
  }
}

.client-shell {
  width: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.client-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: linear-gradient(185deg, #102542 0%, #163d6d 48%, #0f5c93 100%);
  color: #eef6ff;
  overflow: hidden;
}

.client-brand-block {
  padding: 8px 8px 2px;
}

.client-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
}

.client-brand-kicker {
  color: #b9d6f5;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.client-brand-block h1 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.1;
}

.client-sidebar-nav {
  display: grid;
  gap: 8px;
}

.client-sidebar-link {
  width: 100%;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #eef6ff;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.client-sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.client-sidebar-link.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.26);
}

.client-nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 15px;
  line-height: 1;
}

.client-nav-badge {
  margin-left: auto;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d62939;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.client-sidebar-footer {
  margin-top: auto;
  min-width: 0;
}

.client-user-chip {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.client-user-chip:hover,
.client-user-chip.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
}

.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: #17416f;
  font-weight: 900;
}

.client-user-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.client-user-copy strong,
.client-user-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-user-copy span {
  color: #c8ddf4;
  font-size: 12px;
}

.client-main {
  min-width: 0;
  padding: 18px 24px 32px;
}

.client-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.client-shell .topbar {
  position: static;
  z-index: auto;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
  transform: none !important;
  opacity: 1 !important;
  will-change: auto;
}

.client-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-title {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.15;
}

.topbar-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.client-shell .topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.client-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  place-items: center;
  gap: 4px;
  padding: 9px;
}

.client-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.client-overlay {
  display: none;
}

.home-document-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.home-document-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 1px solid #d9e5f6;
  border-radius: 22px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 12px 26px rgba(17, 34, 66, 0.08);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 4px;
}

.section-head h2,
.section-head p {
  margin: 0;
}

.section-head h2 {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 900;
}

.section-head p {
  margin-top: 7px;
  color: var(--muted);
  max-width: 760px;
}

.section-lead {
  margin: 0 !important;
  font-size: 16px;
  line-height: 1.5;
}

.history-page {
  gap: 16px;
}

.history-filters {
  padding: 14px;
  border: 1px solid #d9e5f6;
  border-radius: 18px;
  background: #fff;
}

.history-list-shell {
  display: grid;
  gap: 12px;
  border: 1px solid #d9e5f6;
  border-radius: 22px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 12px 26px rgba(17, 34, 66, 0.08);
}

.history-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-list-head strong {
  font-size: 15px;
}

.history-list-head span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .home-document-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .client-shell {
    grid-template-columns: 1fr;
  }

  .client-sidebar {
    position: fixed;
    z-index: 62;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(86vw, 300px);
    transform: translateX(-100%);
    transition: transform 0.24s ease;
  }

  .client-shell.sidebar-open .client-sidebar {
    transform: translateX(0);
  }

  .client-overlay {
    position: fixed;
    inset: 0;
    z-index: 61;
    background: rgba(10, 22, 41, 0.46);
  }

  .client-shell.sidebar-open .client-overlay {
    display: block;
  }

  .client-menu-toggle {
    display: inline-grid;
  }

  .client-main {
    padding: 14px 14px calc(22px + env(safe-area-inset-bottom));
  }

  .client-topbar,
  .section-head,
  .finance-dashboard-head,
  .finance-summary-head {
    flex-direction: column;
    align-items: stretch;
  }

  .client-shell .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .topbar-title {
    font-size: 22px;
  }

  .section-head h2 {
    font-size: 24px;
  }

  .history-filters {
    grid-template-columns: 1fr;
  }

  .home-document-panel,
  .history-list-shell {
    border-radius: 18px;
    padding: 14px;
  }
}

/* ---------- Autocomplete (clients / articles) ---------- */
.autocomplete-wrap {
  position: relative;
}

.autocomplete-wrap > input {
  width: 100%;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 35;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line, #d2e1f8);
  border-radius: 12px;
  box-shadow: 0 18px 38px rgba(10, 22, 41, 0.16);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.autocomplete-empty {
  padding: 12px 14px;
  color: var(--muted, #7e8ea9);
  font-size: 13px;
  text-align: center;
}

.autocomplete-item {
  appearance: none;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 1px 10px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--text, #1c1b20);
  transition: background 0.12s ease;
}

.autocomplete-item:hover,
.autocomplete-item:focus {
  background: rgba(96, 76, 255, 0.08);
  outline: none;
}

.autocomplete-item-title {
  grid-column: 1;
  grid-row: 1;
  font-weight: 600;
  font-size: 14px;
}

.autocomplete-item-meta {
  grid-column: 1;
  grid-row: 2;
  font-size: 12px;
  color: var(--muted, #7e8ea9);
}

.autocomplete-item-delete {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  color: #94a3b8;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.autocomplete-item-delete:hover {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
}

/* ---------- Modal preview PDF (génération facture) ---------- */
.invoice-builder-preview-modal {
  width: min(96vw, 1080px);
  max-height: min(94vh, 920px);
  display: grid;
  gap: 14px;
}

.invoice-builder-preview-frame {
  width: 100%;
  min-height: 60vh;
  height: 70vh;
  border: 1px solid var(--line, #d2e1f8);
  border-radius: 12px;
  background: #f6f7fb;
}

@media (max-width: 720px) {
  .invoice-builder-preview-frame {
    height: 56vh;
    min-height: 360px;
  }
}
