:root {
  --radius: 12px;
  --soft: #f3f5f9;
  --muted: #657084;
}
body {
  background: #f3f5f9;
}
body:before {
  opacity: 0.025;
}
.app-header {
  position: relative;
  grid-template-columns: auto 1fr auto;
  background: #fff;
  backdrop-filter: none;
  padding: 22px 4vw;
  gap: 24px;
}
.brand-lockup {
  width: 112px;
}
.brand-logo {
  max-width: 112px;
}
.header-copy h1 {
  font-size: clamp(18px, 2vw, 28px);
  letter-spacing: -0.045em;
  line-height: 1.15;
}
.header-copy p {
  font-size: 10px;
  letter-spacing: 0.15em;
}
.header-actions {
  flex-wrap: wrap;
}
.button {
  min-height: 44px;
  font-size: 12px;
  box-shadow: none !important;
}
.button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.button.primary {
  background: #075dff;
}
.button.secondary {
  background: #edf1f7;
  color: #334155;
}
.studio-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 4vw;
  background: #fff;
  border-bottom: 1px solid #e3e8f0;
}
.studio-nav > div {
  display: flex;
  gap: 8px;
}
.nav-tab {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #657084;
  font-weight: 700;
}
.nav-tab.active {
  background: #eaf0ff;
  color: #075dff;
}
.feedback {
  margin: 16px 4vw 0;
  padding: 12px 16px;
  border: 1px solid #dce5f4;
  background: #fff;
  border-radius: 10px;
  font-size: 13px;
  color: #43526b;
}
.feedback.error {
  color: #a61b25;
  border-color: #f1b7bd;
  background: #fff4f4;
}
.workspace {
  padding: 28px 4vw 48px;
  grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.15fr);
  gap: 36px;
  max-width: 1800px;
  margin: auto;
}
.editor-intro {
  padding: 6px 2px 10px;
}
.eyebrow {
  color: #075dff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.editor-intro h2,
.history-heading h2 {
  font-size: 27px;
  letter-spacing: -0.055em;
  margin: 8px 0;
}
.editor-intro > p:not(.eyebrow),
.history-heading p {
  color: #657084;
  font-size: 13px;
  line-height: 1.65;
}
.editor-intro #saveState {
  font-size: 11px;
  color: #657084;
  display: block;
  margin-top: 16px;
}
.panel-section {
  padding: 22px;
  background: #fff;
  border-color: #e4e9f1;
  box-shadow: none;
}
.section-heading {
  margin-bottom: 20px;
}
.section-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #eaf0ff;
  border-radius: 8px;
  font-size: 10px;
}
.section-heading h2 {
  font-size: 15px;
  letter-spacing: -0.02em;
}
.field-grid {
  gap: 16px;
}
input,
select,
textarea {
  font-size: 14px;
  border-color: #dce2eb;
  min-height: 44px;
}
label span {
  font-size: 11px;
  color: #596579;
  letter-spacing: 0.01em;
}
.line-editor {
  grid-template-columns: 1fr 1fr 40px;
  padding: 14px;
  gap: 12px;
  background: #f7f9fc;
}
.line-editor .description-field {
  grid-column: 1/-1;
}
.line-editor output {
  grid-column: 1/3;
  justify-self: start;
  font-size: 14px;
}
.line-editor .icon-button {
  grid-column: 3;
  grid-row: 3;
  min-width: 40px;
}
.service-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.service-presets button {
  background: #fff;
  border: 1px solid #d9e3f3;
  color: #47618e;
  border-radius: 20px;
  padding: 8px 11px;
  font-size: 10px;
  min-height: 34px;
}
.preview-panel {
  top: 20px;
}
.preview-toolbar {
  padding: 12px 2px 18px;
}
.preview-toolbar p {
  font-size: 10px;
}
.preview-toolbar strong {
  font-size: 28px;
  letter-spacing: -0.045em;
  margin-top: 6px;
}
.status-pill {
  font-size: 10px;
  background: #e2e8f0;
  color: #45536a;
  min-height: 27px;
}
#paperViewport {
  width: 100%;
  position: relative;
}
.invoice-page {
  width: 794px;
  max-width: none;
  min-height: 1123px;
  padding: 52px 46px 36px;
  transform-origin: top left;
  border-radius: 3px;
  background: #fff url("assets/backgroundpdf.png") center/cover no-repeat;
  box-shadow: 0 12px 38px #162b4a12;
  overflow-wrap: anywhere;
}
.invoice-page:before {
  width: 120px;
  height: 120px;
  border-radius: 0 0 70px 0;
}
.document-top-accent {
  width: 65px;
  height: 70px;
  border-radius: 0 0 42px 0;
}
.invoice-document-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-bottom: 25px;
  gap: 26px;
}
.invoice-logo {
  width: 122px;
  height: 112px;
  padding: 0;
  object-fit: contain;
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}
.invoice-title-block {
  text-align: right;
}
.invoice-title-block h2 {
  font-size: 29px;
  letter-spacing: -0.045em;
  max-width: 430px;
  line-height: 1.1;
}
.invoice-title-block p {
  font-size: 11px;
}
.invoice-title-block span {
  font-size: 10px;
  min-height: 23px;
  padding: 4px 10px;
}
.invoice-meta-grid {
  grid-template-columns: 1fr 1fr 150px;
  gap: 18px;
  padding: 18px;
  background: #fffffff0;
  box-shadow: none;
  backdrop-filter: none;
}
.invoice-meta-grid h3 {
  font-size: 13px;
}
.invoice-meta-grid p {
  font-size: 11px;
  line-height: 1.45;
}
.invoice-meta-grid span {
  font-size: 9px;
}
.date-card {
  padding: 13px;
  box-shadow: none;
}
.date-card dt {
  font-size: 9px;
}
.date-card dd {
  font-size: 11px;
}
.date-card div + div {
  margin-top: 12px;
  padding-top: 12px;
}
.invoice-lines {
  margin-top: 20px;
  padding: 10px;
  box-shadow: none;
  backdrop-filter: none;
  background: #fffffff0;
}
.invoice-lines table {
  table-layout: fixed;
}
.invoice-lines th:first-child {
  width: 46%;
}
.invoice-lines th:nth-child(2) {
  width: 10%;
}
.invoice-lines th:nth-child(3),
.invoice-lines th:nth-child(4) {
  width: 22%;
}
.invoice-lines td,
.invoice-lines th {
  padding: 11px 9px;
  font-size: 11px;
}
.invoice-lines th {
  font-size: 9px;
  letter-spacing: 0.08em;
}
.invoice-lines td:first-child {
  white-space: pre-wrap;
}
.invoice-summary-section {
  grid-template-columns: 1fr 240px;
  gap: 22px;
  margin-top: 20px;
}
.invoice-notes {
  padding: 15px;
  background: #ffffffed;
}
.invoice-notes p {
  font-size: 11px;
  line-height: 1.5;
}
.invoice-notes h3 {
  font-size: 9px;
}
.invoice-notes h3:not(:first-child) {
  margin-top: 14px;
}
.totals-box {
  padding: 13px;
  box-shadow: none;
  background: #f4f7fcee;
}
.totals-box div {
  font-size: 11px;
  padding: 7px 0;
  gap: 10px;
}
.grand-total strong {
  font-size: 21px;
}
.totals-box .grand-total {
  padding-top: 12px;
}
.brand-signature {
  margin-top: 22px;
}
.brand-signature span {
  font-size: 8px;
  width: auto;
}
.invoice-footer {
  margin-top: 12px;
  padding-top: 14px;
}
.invoice-footer p {
  font-size: 11px;
}
.installment-banner {
  grid-template-columns: 1fr auto;
  padding: 14px;
  gap: 16px;
  margin-top: 16px;
  background: #f0f5ff;
}
.installment-banner h3 {
  font-size: 13px;
}
.installment-banner p {
  font-size: 10px;
}
.installment-banner span {
  font-size: 8px;
}
.installment-amount {
  text-align: right;
  min-width: 125px;
}
.installment-amount strong {
  font-size: 17px;
}
.pdf-host {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 794px;
  z-index: -10;
}
.pdf-document {
  box-shadow: none !important;
  min-height: 1123px;
}
.compact-document {
  padding: 36px 40px 28px;
}
.compact-document .invoice-document-header {
  margin-bottom: 15px;
}
.compact-document .invoice-logo {
  height: 80px;
}
.compact-document .invoice-lines td {
  padding: 7px 8px;
  font-size: 10px;
}
.compact-document .invoice-meta-grid {
  padding: 13px;
}
.compact-document .invoice-lines,
.compact-document .invoice-summary-section {
  margin-top: 13px;
}
.compact-document .invoice-notes p {
  font-size: 10px;
}
.compact-document .brand-signature {
  margin-top: 15px;
}
.history-panel {
  max-width: 1500px;
  margin: 32px auto;
  padding: 0 4vw 48px;
}
.history-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.metrics > div {
  background: #fff;
  border: 1px solid #e3e9f1;
  border-radius: 14px;
  padding: 24px;
}
.metrics span {
  display: block;
  font-size: 12px;
  color: #657084;
}
.metrics strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  letter-spacing: -0.04em;
}
.history-filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
.history-row {
  display: grid;
  grid-template-columns: 1fr 150px 125px auto;
  gap: 16px;
  align-items: center;
  background: white;
  border: 1px solid #e3e9f1;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 10px;
  font-size: 13px;
}
.history-row > div > span,
.history-row small {
  display: block;
  margin-top: 6px;
  color: #657084;
}
.history-row > div:first-child {
  overflow-wrap: anywhere;
}
.history-row > strong {
  white-space: nowrap;
}
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.row-actions .button {
  font-size: 10px;
  padding: 0 10px;
  min-height: 38px;
}
.history-status {
  font-size: 10px;
  font-weight: 800;
  color: #4162a0 !important;
}
.history-status[data-status="Payée"] {
  color: #168058 !important;
}
.history-status[data-status="En retard"] {
  color: #b6412d !important;
}
.empty-state {
  text-align: center;
  padding: 70px 20px;
  background: white;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
}
.empty-state > span {
  font-size: 36px;
  color: #075dff;
}
.empty-state h3 {
  font-size: 18px;
}
.empty-state p {
  font-size: 13px;
  color: #657084;
}
.login-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 10%, #cddbff, transparent 55%), #f3f5fa;
}
.login-card {
  width: min(100%, 460px);
  background: white;
  padding: 40px;
  border-radius: 22px;
  border: 1px solid #e0e6f0;
  box-shadow: 0 25px 80px #16305b12;
}
.login-logo {
  width: 160px;
  height: 70px;
  object-fit: contain;
  object-position: left;
}
.login-card h1 {
  font-size: 30px;
  letter-spacing: -0.055em;
  line-height: 1.12;
}
.login-card > p:not(.eyebrow) {
  font-size: 13px;
  color: #657084;
  line-height: 1.7;
}
.login-card form {
  display: grid;
  gap: 20px;
  margin-top: 26px;
}
.login-card small {
  font-size: 10px;
  color: #8290a4;
}
.login-card #loginError {
  margin: 0;
  color: #b72d3a;
  font-size: 12px;
}
.login-card .button {
  width: 100%;
  min-height: 48px;
}
button:focus-visible {
  outline: 3px solid #90b1ff;
  outline-offset: 3px;
}
@media (max-width: 1100px) {
  .app-header {
    grid-template-columns: auto 1fr;
  }
  .header-actions {
    grid-column: 1/-1;
  }
  .workspace {
    grid-template-columns: 1fr 1fr;
    gap: 22px;
  }
  .history-row {
    grid-template-columns: 1fr 120px 110px;
  }
  .row-actions {
    grid-column: 1/-1;
  }
  .discount-control {
    grid-column: 1/-1;
  }
}
@media (max-width: 800px) {
  .workspace {
    grid-template-columns: 1fr;
    max-width: 650px;
  }
  .preview-panel {
    position: static;
  }
  .app-header {
    gap: 12px;
    padding: 18px 5vw;
  }
  .header-copy h1 {
    font-size: 20px;
  }
  .header-actions {
    display: flex;
    gap: 8px;
  }
  .header-actions .button {
    flex: 1;
    font-size: 11px;
    padding: 0 9px;
  }
  .studio-nav {
    padding: 10px 5vw;
    gap: 6px;
  }
  .nav-tab {
    padding: 8px 11px;
    font-size: 12px;
  }
  .studio-nav > .button {
    font-size: 10px;
    padding: 0 10px;
  }
  .history-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .metrics {
    gap: 8px;
  }
  .metrics > div {
    padding: 15px;
  }
  .metrics strong {
    font-size: 20px;
  }
  .metrics span {
    font-size: 10px;
  }
  .history-filters {
    grid-template-columns: 1fr 1fr;
  }
  .history-filters > label:first-child {
    grid-column: 1/-1;
  }
  .history-row {
    grid-template-columns: 1fr 100px;
  }
  .history-row > strong {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }
  .history-row > div:nth-child(2) {
    grid-column: 1/-1;
    display: flex;
    gap: 14px;
    align-items: center;
  }
  .field-grid,
  .split-billing-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .login-card {
    padding: 30px;
  }
}
@media (max-width: 420px) {
  .brand-lockup,
  .brand-logo {
    width: 86px;
  }
  .header-copy h1 {
    font-size: 18px;
  }
  .header-copy p {
    font-size: 8px;
  }
  .field-grid,
  .split-billing-fields {
    grid-template-columns: 1fr;
  }
  .panel-section {
    padding: 17px;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
  .metrics > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .metrics strong {
    margin: 0;
  }
  .login-card h1 {
    font-size: 27px;
  }
  input,
  select,
  textarea {
    font-size: 16px;
  }
  .header-actions .button {
    font-size: 10px;
  }
  .workspace {
    padding-inline: 4vw;
  }
  .discount-control {
    grid-column: auto;
  }
}
@media print {
  .studio-nav,
  .feedback,
  .history-panel,
  .editor-intro {
    display: none !important;
  }
  #paperViewport {
    height: auto !important;
  }
  .invoice-page {
    transform: none !important;
    box-shadow: none;
  }
  body {
    background: #fff;
  }
  @page {
    size: A4;
    margin: 0;
  }
}
#paperViewport {
  overflow: hidden;
}
.invoice-brand {
  padding: 0 8px;
  background: #fff;
  border-radius: 10px;
}
.brand-lockup {
  width: 84px;
  height: 62px;
}
.brand-logo {
  max-width: 84px;
  max-height: 62px;
}
.login-logo {
  width: 110px;
  height: 110px;
}
.invoice-page .invoice-brand {
  background: #ffffffeb;
}
.advanced > summary {
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  min-height: 28px;
  list-style-position: inside;
}
.advanced[open] > summary {
  margin-bottom: 20px;
}
.advanced > summary::marker {
  color: #075dff;
}
.preview-panel {
  scroll-margin-top: 20px;
}
#previewJump {
  display: none;
}
@media (max-width: 800px) {
  #previewJump {
    display: inline-block;
  }
  .studio-nav {
    flex-wrap: wrap;
  }
  .studio-nav > div {
    gap: 0;
  }
  .nav-tab {
    font-size: 11px;
    padding-inline: 10px;
  }
  .header-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: #ffffffed;
    border-top: 1px solid #dce3ed;
    z-index: 50;
  }
  .app-header {
    z-index: 50;
  }
  body {
    padding-bottom: 72px;
  }
  .login-page {
    padding-bottom: 24px;
  }
}
