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

:root {
  --bg: #eef5f1;
  --bg-2: #ffffff;
  --card: #ffffff;
  --ink: #16231f;
  --muted: #6b7b74;
  --accent: #7adcc5;
  --accent-2: #f2b066;
  --stroke: transparent;
  --shadow: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: none;
  backdrop-filter: blur(12px);
}

.topbar__brand {
  min-width: 0;
}

.topbar__identity {
  display: grid;
  gap: 2px;
}

.topbar__title {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
}

.topbar__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.topbar__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-weight: 600;
}

.topbar__toggle {
  display: none;
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
}

.topbar__nav a {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid transparent;
}

.topbar__nav a:hover {
  border-color: rgba(122, 220, 197, 0.5);
}

.topbar__logout {
  margin: 0;
}

.topbar__logout button {
  appearance: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid transparent;
}

.topbar__logout button:hover,
.topbar__toggle:hover {
  border-color: rgba(122, 220, 197, 0.5);
}

@media (max-width: 1024px) {
  .topbar {
    padding: 12px 14px;
    gap: 10px;
    justify-content: flex-start;
    align-items: flex-start;
  }

  .topbar__brand {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar__meta {
    margin-top: 2px;
    font-size: 0.8rem;
    overflow-wrap: anywhere;
  }

  .topbar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }

  .topbar__nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
  }

  .topbar__nav.is-open {
    display: flex;
  }

  .topbar__nav {
    flex-wrap: nowrap;
  }

  .topbar__nav a,
  .topbar__logout button {
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    padding: 7px 11px;
  }

  .topbar__logout {
    width: 100%;
  }
}

.page {
  padding: 40px 24px 80px;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 32px;
}

.hero {
  display: grid;
  gap: 20px;
  padding: 32px;
  border: none;
  background: var(--card);
  border-radius: 24px;
  box-shadow: none;
}

.hero h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(2.2rem, 3vw, 3rem);
  margin: 0;
  letter-spacing: 0.02em;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  padding: 20px;
  border-radius: 20px;
  border: none;
  background: var(--card);
  box-shadow: none;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.form-panel {
  padding: 24px;
  border-radius: 20px;
  border: none;
  background: var(--card);
  box-shadow: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px 32px;
}

.line-items {
  display: grid;
  gap: 16px;
}

.line-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  align-items: end;
  gap: 16px;
}

.line-grid .field-description {
  grid-column: 1;
}

@media (max-width: 640px) {
  .line-grid {
    grid-template-columns: 1fr;
  }
  .line-grid .field-description {
    grid-column: auto;
  }
}


.form-field {
  display: grid;
  grid-template-columns: minmax(130px, 32%) 1fr;
  align-items: start;
  column-gap: 14px;
  row-gap: 6px;
}

.form-field label {
  font-size: 1rem;
  color: var(--muted);
  text-align: right;
  font-weight: 600;
  padding-right: 6px;
  line-height: 1.2;
  white-space: normal;
}

.form-field label::after {
  content: ":";
  margin-left: 4px;
}

.form-field label.required::before {
  content: "* ";
  color: #c83434;
}

.pricing-module-field {
  display: block;
  background: rgba(22, 177, 145, 0.08);
  border: 1px solid rgba(22, 177, 145, 0.25);
  border-radius: 14px;
  padding: 14px 16px;
}

.pricing-module-list {
  gap: 10px;
}

.pricing-option {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  column-gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(22, 35, 31, 0.14);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  color: var(--ink);
  font-weight: 500;
  padding-right: 0;
}

.pricing-option input[type="radio"],
.pricing-option input[type="checkbox"] {
  margin-top: 2px;
  justify-self: start;
}

.pricing-module-field .pricing-option::after,
.pricing-module-field .pricing-ack::after {
  content: none;
}

.pricing-module-field .pricing-option::before,
.pricing-module-field .pricing-ack::before {
  content: none;
}

.pricing-module-field .pricing-ack {
  text-align: left;
  padding-right: 0;
}

.pricing-module-total {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(22, 177, 145, 0.12);
  color: #0f5e4d;
}

.pricing-module-total strong {
  white-space: nowrap;
}

.amount-nowrap {
  white-space: nowrap;
}

.pricing-ack {
  margin-top: 4px;
  font-weight: 600;
  color: var(--ink);
}

.pricing-inline-error {
  margin-top: 8px;
  color: #a62828;
  font-size: 0.9rem;
  font-weight: 600;
}

.form-field.pricing-module-field {
  display: block;
}

.form-field.pricing-module-field label.pricing-option,
.form-field.pricing-module-field label.pricing-ack {
  text-align: left;
  padding-right: 0;
  color: var(--ink);
  font-weight: 500;
}

.form-field.pricing-module-field label.pricing-option::after,
.form-field.pricing-module-field label.pricing-ack::after,
.form-field.pricing-module-field label.pricing-option::before,
.form-field.pricing-module-field label.pricing-ack::before {
  content: none;
}

.pricing-module-field .pricing-option.checklist-field,
.pricing-module-field .pricing-ack.checklist-field {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  column-gap: 10px;
}

.pricing-module-field .pricing-option.checklist-field input[type="radio"],
.pricing-module-field .pricing-option.checklist-field input[type="checkbox"],
.pricing-module-field .pricing-ack.checklist-field input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  margin: 0;
  justify-self: start;
  align-self: center;
  border: none;
  box-shadow: none;
  background: transparent;
}

.pricing-module-field .pricing-option.checklist-field span,
.pricing-module-field .pricing-ack.checklist-field span {
  display: block;
  line-height: 1.25;
}

.form-field input {
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  height: 48px;
}

.form-field select,
.form-field textarea {
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
}

.form-field textarea {
  min-height: 130px;
  resize: vertical;
  grid-column: 2;
}

.form-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--accent);
  justify-self: start;
}

.form-field textarea,
.form-field select,
.form-field input {
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 720px) {
  .form-field {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .form-field label {
    text-align: left;
  }
  .form-field textarea {
    grid-column: auto;
  }
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
button {
  box-shadow: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: rgba(22, 35, 31, 0.45);
  font-size: 1.05rem;
}

.form-field--checkbox {
  align-items: center;
}

.form-field--checkbox input[type="checkbox"] {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(22, 35, 31, 0.35);
  border-radius: 6px;
  background: #fff;
  accent-color: #16b191;
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: checkbox;
  -moz-appearance: auto;
}

.form-field--checkbox input[type="checkbox"]:checked {
  outline: 2px solid rgba(22, 177, 145, 0.28);
  outline-offset: 1px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.status-badge.is-active {
  background: rgba(22, 177, 145, 0.18);
  color: #0f5e4d;
}

.status-badge.is-inactive {
  background: rgba(120, 131, 125, 0.2);
  color: #425048;
}

.checklist-list {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.checklist-item {
  padding: 14px;
  border-radius: 16px;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  display: grid;
  gap: 10px;
}

.checklist-label {
  font-size: 0.95rem;
}

.checklist-help {
  display: inline-block;
  margin-left: 8px;
  position: relative;
}

.checklist-help__trigger {
  list-style: none;
  cursor: pointer;
  width: 19px;
  height: 19px;
  border-radius: 999px;
  border: 1px solid rgba(22, 35, 31, 0.32);
  background: #fff;
  color: #0f6d5a;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.checklist-help__trigger::-webkit-details-marker {
  display: none;
}

.checklist-help[open] .checklist-help__trigger {
  background: rgba(22, 177, 145, 0.18);
}

.checklist-help__content {
  position: absolute;
  top: 24px;
  left: 0;
  z-index: 3;
  width: min(560px, 88vw);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(22, 35, 31, 0.14);
  background: #fff;
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.4;
}

.checklist-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.checklist-tag.is-mandatory {
  background: rgba(198, 52, 52, 0.14);
  color: #9a2525;
}

.checklist-tag.is-recommended {
  background: rgba(22, 177, 145, 0.14);
  color: #0f6d5a;
}

.checklist-fields {
  display: grid;
  grid-template-columns: 120px 1fr 1fr 2fr;
  gap: 10px;
  align-items: center;
}

.checklist-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.combustion-measures {
  width: 100%;
}

.combustion-measures__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 8px;
  width: 100%;
}

.combustion-measures__field {
  display: grid;
  gap: 4px;
  color: var(--ink);
  font-size: 0.78rem;
}

.combustion-measures__field input[type="text"] {
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: var(--ink);
}

.send-doc-email {
  max-width: 620px;
  margin-bottom: 12px;
}

.checklist-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.checklist-fields select,
.checklist-fields input[type="text"] {
  width: 100%;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: var(--ink);
}

.form-field select,
.form-field input,
.form-field textarea {
  font-size: 1rem;
}

.signature-pad {
  border: none;
  border-radius: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.05);
}

.signature-pad canvas {
  width: 100%;
  height: 180px;
  display: block;
  background: rgba(255, 255, 255, 0.02);
  touch-action: none;
}

.note {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
  border: none;
}

@media (max-width: 900px) {
  .checklist-fields {
    grid-template-columns: 1fr;
  }

  .combustion-measures__grid {
    grid-template-columns: 1fr;
  }
}

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(122, 220, 197, 0.18);
  border: none;
  color: var(--ink);
}

.table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 16px;
  overflow: hidden;
  border: none;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.95rem;
  border-bottom: none;
}

.table th {
  background: rgba(0, 0, 0, 0.04);
  color: var(--muted);
  font-weight: 600;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr.clickable-row {
  cursor: pointer;
}

.table tr.clickable-row:hover td {
  background: rgba(122, 220, 197, 0.14);
}

@media (max-width: 760px) {
  .table-wrap {
    overflow: visible;
  }

  .table {
    border: 0;
    overflow: visible;
  }

  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .table tbody {
    display: grid;
    gap: 10px;
  }

  .table tr {
    display: grid;
    gap: 6px;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
  }

  .table td {
    display: grid;
    grid-template-columns: minmax(96px, 40%) 1fr;
    gap: 8px;
    align-items: start;
    padding: 0;
    font-size: 0.92rem;
  }

  .table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .table td.cell-full {
    grid-template-columns: 1fr;
  }

  .table td.cell-full::before {
    content: none;
  }

  .table td.cell-actions {
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    padding-top: 8px;
  }

  .table td.cell-actions::before {
    content: "Actions";
  }

  .actions {
    gap: 6px;
  }
}

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

.action-link {
  padding: 6px 10px;
  border-radius: 10px;
  border: none;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.04);
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

.action-link--strong {
  background: rgba(201, 153, 92, 0.18);
  border: 1px solid rgba(201, 153, 92, 0.35);
}

button.action-link {
  appearance: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.table-actions-menu {
  display: block;
}

.table-actions-menu summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
}

.table-actions-menu summary::-webkit-details-marker {
  display: none;
}

.table-actions-panel {
  margin-top: 8px;
  min-width: 170px;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(22, 35, 31, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.table-actions-panel .actions {
  flex-direction: column;
  align-items: stretch;
}

.table-actions-panel .action-link,
.table-actions-panel .action-inline-form {
  width: 100%;
}

.table-actions-panel .action-link {
  justify-content: center;
}

.action-inline-form {
  margin: 0;
}

.invoice-list-table th,
.invoice-list-table td,
.quote-list-table th,
.quote-list-table td {
  vertical-align: middle;
}

.invoice-list-table th:nth-child(1),
.invoice-list-table td:nth-child(1),
.quote-list-table th:nth-child(1),
.quote-list-table td:nth-child(1),
.invoice-list-table th:nth-child(4),
.invoice-list-table td:nth-child(4),
.quote-list-table th:nth-child(4),
.quote-list-table td:nth-child(4),
.invoice-list-table th:nth-child(5),
.invoice-list-table td:nth-child(5),
.quote-list-table th:nth-child(5),
.quote-list-table td:nth-child(5),
.invoice-list-table th:nth-child(6),
.invoice-list-table td:nth-child(6) {
  white-space: nowrap;
}

.invoice-list-table th:nth-child(5),
.invoice-list-table td:nth-child(5),
.quote-list-table th:nth-child(5),
.quote-list-table td:nth-child(5),
.invoice-list-table th:nth-child(6),
.invoice-list-table td:nth-child(6) {
  text-align: right;
}

.head-actions .action-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.client-search-form {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.client-search-input {
  min-width: 300px;
  max-width: 420px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: var(--ink);
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .client-search-form {
    width: 100%;
  }

  .client-search-input {
    min-width: 0;
    max-width: none;
  }
}

.row-link {
  cursor: pointer;
}

.row-link:hover td {
  background: rgba(0, 0, 0, 0.025);
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  border: none;
  color: var(--muted);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cta {
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #0f1d18;
  font-weight: 700;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: none;
}

.cta.secondary {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
  border: none;
  box-shadow: none;
}

.section-title {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  margin: 0 0 12px;
}

.list {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.client-contact-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
}

.client-contact-form {
  margin-top: 14px;
}

.client-contact-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.client-contact-field {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.client-contact-default {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--ink);
  padding-top: 30px;
}

.client-contact-actions-list {
  margin-top: 14px;
}

.client-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contract-hash {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.35;
  word-break: break-all;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.badge span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-2);
  display: inline-block;
}

.footer {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding-top: 12px;
}

@media (max-width: 640px) {
  .page {
    padding: 28px 16px 64px;
  }
  .hero {
    padding: 20px;
  }
  .hero h1 {
    font-size: 1.8rem;
  }
  .cta-row {
    width: 100%;
  }
  .cta,
  .cta.secondary {
    width: 100%;
    justify-content: center;
  }
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

@media (max-width: 760px) {
  .page-head,
  .head-actions {
    align-items: stretch;
  }

  .head-actions > * {
    width: 100%;
  }

  .head-actions .action-inline-form {
    width: 100%;
  }
}

.chip {
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--stroke);
  font-weight: 600;
  cursor: pointer;
}

.stepper {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.step {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 0.85rem;
}

.step.active {
  background: rgba(122, 220, 197, 0.25);
  color: var(--ink);
  border-color: rgba(122, 220, 197, 0.45);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.summary-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.03);
}

.summary-title {
  font-size: 0.85rem;
  color: var(--muted);
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 6px 0;
}

.summary-muted {
  font-size: 0.9rem;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0 12px;
}

.tab {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.03);
  color: var(--ink);
  font-weight: 600;
}

.tab.active {
  border-color: rgba(122, 220, 197, 0.45);
  background: rgba(122, 220, 197, 0.2);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.summary-title-spaced {
  margin-top: 12px;
}

.lines-head {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 8px 8px;
}

.line-amount {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.line-kind-section .line-grid,
.line-kind-note .line-grid {
  grid-template-columns: 1fr;
}

.line-kind-section .line-grid .form-field:not(.field-description),
.line-kind-note .line-grid .form-field:not(.field-description) {
  display: none;
}

.line-kind-section .field-description textarea,
.line-kind-note .field-description textarea {
  display: none;
}

.line-kind-section .field-description .text-only-line-input,
.line-kind-note .field-description .text-only-line-input {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
}

.line-kind-section .field-description .text-only-line-input::placeholder,
.line-kind-note .field-description .text-only-line-input::placeholder {
  color: rgba(22, 35, 31, 0.45);
}

.line-kind-section .field-description .text-only-line-input,
.line-kind-note .field-description .text-only-line-input {
  font-weight: 600;
}

.section-subtotal {
  text-align: right;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 8px 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
  margin-top: 4px;
}

.form-field.full-span {
  grid-column: 1 / -1;
}

.line-editor {
  padding: 16px;
  background: rgba(0, 0, 0, 0.015);
  border: 1px solid rgba(0, 0, 0, 0.07);
}

.live-total-inline {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(22, 177, 145, 0.22);
  border-radius: 12px;
  background: rgba(22, 177, 145, 0.08);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
}

.live-total-inline__item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
}

.live-total-inline__item strong {
  color: var(--ink);
  font-size: 1rem;
  white-space: nowrap;
}

.live-total-inline__item--grand strong {
  font-size: 1.15rem;
}

.live-total-panel {
  margin-top: 14px;
  margin-left: auto;
  width: min(360px, 100%);
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(22, 177, 145, 0.22);
  background: rgba(22, 177, 145, 0.08);
  display: grid;
  gap: 8px;
}

.live-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.live-total-row strong {
  color: var(--ink);
  font-size: 1rem;
  white-space: nowrap;
}

.live-total-row--grand {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(22, 177, 145, 0.28);
}

.live-total-row--grand strong {
  font-size: 1.25rem;
}

.line-actions {
  margin-top: 12px;
}

.line-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.line-drag-handle {
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  padding: 6px 10px;
  cursor: grab;
}

.line-drag-handle:active {
  cursor: grabbing;
}

[data-collection-item].is-dragging {
  opacity: 0.6;
}

.catalog-picker {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.75);
  display: grid;
  gap: 10px;
}

.form-submit-row {
  margin-top: 18px;
}

.invoice-form {
  display: grid;
  gap: 16px;
}

.invoice-form .summary-card {
  background: #f8fbfa;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.profitability-panel {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f8fbfa;
}

.profitability-panel .section-title {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.profitability-panel .table td input,
.profitability-panel .table td select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: var(--ink);
}

.profitability-grid {
  margin-top: 10px;
}

.profitability-metrics {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 16px;
}

.profitability-metrics strong {
  color: var(--ink);
}

.profitability-value-positive {
  color: #0e6c4a !important;
}

.profitability-value-negative {
  color: #af2d2d !important;
}

.invoice-form .summary-value,
.invoice-form .summary-muted {
  margin-top: 8px;
}

.summary-value-static {
  padding: 10px 0 4px;
  font-weight: 600;
}

.form-hidden {
  display: none;
}

.invoice-form .summary-select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  font-size: 1rem;
  font-weight: 500;
}

.invoice-form .line-items {
  gap: 14px;
}

.invoice-form .line-items > .card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 16px;
}

.invoice-form .line-grid {
  grid-template-columns: minmax(260px, 2.4fr) minmax(96px, 0.9fr) minmax(120px, 1fr) minmax(96px, 0.8fr) minmax(120px, 1fr);
  gap: 14px;
  align-items: start;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.kpi-card,
.workflow-card {
  padding: 18px 20px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(22, 35, 31, 0.08);
}

.kpi-label,
.workflow-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value,
.workflow-value {
  margin-top: 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}

.kpi-help,
.workflow-help,
.table-subline {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.tone-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tone-badge--neutral {
  background: rgba(66, 80, 72, 0.1);
  color: #425048;
}

.tone-badge--warning {
  background: rgba(242, 176, 102, 0.18);
  color: #8a4d11;
}

.tone-badge--info {
  background: rgba(122, 220, 197, 0.18);
  color: #0f6d5a;
}

.tone-badge--success {
  background: rgba(38, 180, 92, 0.15);
  color: #16653a;
}

.tone-badge--danger {
  background: rgba(198, 52, 52, 0.12);
  color: #9a2525;
}

.editor-section {
  display: grid;
  gap: 14px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.section-heading .section-title {
  margin-bottom: 4px;
}

.advanced-panel {
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(22, 35, 31, 0.08);
  overflow: hidden;
}

.advanced-panel summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: 700;
  font-size: 1rem;
  background: rgba(0, 0, 0, 0.025);
}

.advanced-panel summary::-webkit-details-marker {
  display: none;
}

.advanced-panel__body {
  padding: 18px;
}

.quote-secondary-actions {
  width: 100%;
  margin-top: 8px;
}

.quote-secondary-actions .advanced-panel__body {
  padding: 14px 18px;
}

@media (max-width: 760px) {
  .workflow-strip,
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .kpi-value,
  .workflow-value {
    font-size: 1.25rem;
  }

  .section-heading {
    align-items: start;
  }
}

.invoice-form .line-grid .form-field:not(.line-amount) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.invoice-form .line-grid .form-field label {
  text-align: left;
  padding-right: 0;
  font-size: 0.82rem;
}

.invoice-form .line-grid .form-field input,
.invoice-form .line-grid .form-field select {
  min-height: 44px;
}

.invoice-form .line-grid .field-description textarea {
  min-height: 88px;
}

.invoice-form .line-grid .line-amount {
  justify-content: flex-end;
  min-height: 44px;
  align-self: end;
}

/* Keep section/note lines in text-only mode inside quote/invoice editors */
.invoice-form .line-kind-section .line-grid .form-field:not(.field-description),
.invoice-form .line-kind-note .line-grid .form-field:not(.field-description) {
  display: none !important;
}

.invoice-form .line-kind-section .line-grid .line-amount,
.invoice-form .line-kind-note .line-grid .line-amount {
  display: none !important;
}

.monthly-chart {
  display: grid;
  gap: 12px;
}

.monthly-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.monthly-chart__legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot-ca {
  background: #3c8af4;
}

.dot-tva {
  background: #f0a355;
}

.dot-benefit {
  background: #21a176;
}

.monthly-chart__plot {
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 18px 16px 12px;
  background: #f8fbfa;
  overflow: hidden;
}

.monthly-chart__zero {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: var(--zero-line);
  border-top: 1px dashed rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.monthly-chart__months {
  height: 260px;
  display: grid;
  grid-template-columns: repeat(12, minmax(40px, 1fr));
  gap: 8px;
}

.month-group {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-width: 0;
}

.month-bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  align-items: stretch;
}

.metric-bar {
  position: relative;
  min-height: 100%;
}

.metric-bar__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--zero-line);
  height: var(--bar-height);
  border-radius: 6px 6px 0 0;
  opacity: 0.92;
}

.metric-bar.is-negative .metric-bar__fill {
  top: calc(100% - var(--zero-line));
  bottom: auto;
  border-radius: 0 0 6px 6px;
}

.metric-bar__fill--ca {
  background: #3c8af4;
}

.metric-bar__fill--tva {
  background: #f0a355;
}

.metric-bar__fill--benefit {
  background: #21a176;
}

.month-label {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

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

  .invoice-form .line-grid .field-description {
    grid-column: 1 / -1;
  }

  .invoice-form .line-grid .line-amount {
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  .monthly-chart__months {
    grid-template-columns: repeat(6, minmax(40px, 1fr));
    height: auto;
    gap: 10px 8px;
  }

  .month-bars {
    min-height: 110px;
  }

  .lines-head {
    display: none;
  }

  .invoice-form .line-grid .line-amount {
    grid-column: auto;
    justify-content: flex-start;
  }

  .live-total-panel {
    margin-left: 0;
  }

  .live-total-inline {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 14px;
  }

  .client-contact-default {
    padding-top: 0;
  }
}

/* ═══════════════════════════════════════
   Panneau IA Rénovation
═══════════════════════════════════════ */
.ai-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0 0 0 / 0.45);
  z-index: 1000;
  align-items: stretch;
  justify-content: flex-end;
}

.ai-panel-overlay:not([hidden]) {
  display: flex;
}

.ai-panel {
  background: #fff;
  width: min(560px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0 0 0 / 0.15);
  overflow: hidden;
}

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  background: #faf9ff;
  flex-shrink: 0;
}

.ai-panel-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: #6c47ff;
}

.ai-panel-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.ai-panel-close:hover { background: #f3f4f6; }

.ai-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ai-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 110px;
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}
.ai-textarea:focus { outline: 2px solid #6c47ff; border-color: #6c47ff; }

.ai-upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  color: #6b7280;
  font-size: 0.875rem;
  transition: border-color 0.15s;
}
.ai-upload-zone:hover { border-color: #6c47ff; color: #6c47ff; }

.ai-upload-icon { font-size: 1.5rem; display: block; margin-bottom: 0.4rem; }

.ai-file-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ai-file-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f3f4f6;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  max-width: 200px;
}

.ai-file-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.ai-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  font-size: 0.75rem;
  padding: 0 2px;
  flex-shrink: 0;
}
.ai-file-remove:hover { color: #ef4444; }

.ai-status {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin: 0;
}
.ai-status--loading { background: #eff6ff; color: #2563eb; }
.ai-status--success { background: #f0fdf4; color: #15803d; }
.ai-status--error   { background: #fef2f2; color: #b91c1c; }

.ai-result-area {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

.ai-result-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.ai-result-lines {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ai-result-row {
  display: grid;
  grid-template-columns: 1fr 70px 80px 60px 28px;
  gap: 4px;
  align-items: center;
}

.ai-result-section {
  grid-template-columns: 1fr;
  background: #f5f3ff;
  border-radius: 4px;
  padding: 4px 8px;
}

.ai-section-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6c47ff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-result-row input,
.ai-result-row select {
  font-size: 0.8rem;
  padding: 3px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

.ai-row-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 0.8rem;
  padding: 2px;
}
.ai-row-remove:hover { color: #ef4444; }

.ai-result-notes {
  font-size: 0.8rem;
  color: #6b7280;
  border-top: 1px solid #e5e7eb;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  font-style: italic;
}
}

/* ── Compact line editor (table-style) ───────────────────── */

.line-editor {
  display: grid;
  gap: 12px;
  padding: 0;
  background: none;
  border: none;
}

.line-table {
  border: 2px solid #c9cdd4;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.2s, border-style 0.2s;
}

/* Zone vide — contour en pointillés indigo */
.line-table:not(:has([data-collection-item])) {
  border-style: dashed;
  border-color: #a78bfa;
}

.line-table .line-items {
  display: block;
}

.line-head {
  display: grid;
  grid-template-columns: 24px 1fr 76px 104px 68px 96px 28px;
  background: rgba(108, 71, 255, 0.06);
  border-bottom: 2px solid rgba(108, 71, 255, 0.18);
}

.line-head > * {
  padding: 7px 10px;
  font-size: 0.73rem;
  font-weight: 700;
  color: #6c47ff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.line-head > *:first-child,
.line-head > *:last-child {
  padding: 0;
}

.line-row {
  display: grid;
  grid-template-columns: 24px 1fr 76px 104px 68px 96px 28px;
  align-items: stretch;
  border-bottom: 1.5px solid #c9cdd4;
  min-height: 52px;
  background: #fff;
  transition: background 0.1s;
}

.line-row:last-child {
  border-bottom: none;
}

.line-row:hover {
  background: #f8f9ff;
}

.line-row:hover .line-remove {
  opacity: 1;
}

.line-cell--desc {
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.line-cell--num {
  display: flex;
  align-items: stretch;
  border-left: 1.5px solid #c9cdd4;
}

.line-cell--amount {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0d9488;
  white-space: nowrap;
  border-left: 1.5px solid #d1fae5;
  background: rgba(16, 185, 129, 0.04);
}

.line-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0 10px;
  font-size: 0.88rem;
  color: var(--ink);
  font-family: inherit;
  min-height: 48px;
  resize: none;
  outline: none;
  line-height: 1.4;
  display: block;
}

textarea.line-input {
  padding-top: 15px;
  padding-bottom: 13px;
}

input.line-input {
  text-align: right;
}

.line-input[data-line-field="description"] {
  text-align: left;
}

.line-input:focus {
  background: rgba(108, 71, 255, 0.04);
  outline: 2px solid rgba(108, 71, 255, 0.22);
  outline-offset: -2px;
  border-radius: 4px;
  position: relative;
  z-index: 1;
}

.line-row .line-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: grab;
  font-size: 1.25rem;
  padding: 0;
  border-radius: 0;
  align-self: stretch;
  transition: color 0.12s, background 0.12s;
}

.line-row:hover .line-drag-handle {
  background: rgba(108, 71, 255, 0.06);
}

.line-row .line-drag-handle:hover {
  color: #6c47ff;
  background: rgba(108, 71, 255, 0.1);
}

.line-row .line-drag-handle:active {
  cursor: grabbing;
}

.line-remove {
  border: none;
  background: transparent;
  color: rgba(22, 35, 31, 0.28);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  align-self: stretch;
  border-radius: 0;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
}

.line-remove:hover {
  color: #c62828;
  background: rgba(198, 40, 40, 0.07);
  opacity: 1;
}

/* Section rows */
[data-collection-item][data-line-kind="section"] {
  background: rgba(108, 71, 255, 0.05);
  box-shadow: inset 3px 0 0 #7c3aed;
}

[data-collection-item][data-line-kind="section"] .line-cell--num,
[data-collection-item][data-line-kind="section"] .line-cell--amount {
  display: none;
}

[data-collection-item][data-line-kind="section"] .line-cell--desc {
  grid-column: 2;
}

[data-collection-item][data-line-kind="section"] .line-remove {
  grid-column: 7;
}

[data-collection-item][data-line-kind="section"] .line-input,
[data-collection-item][data-line-kind="section"] .text-only-line-input {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  color: #5b21b6;
  text-align: left;
}

/* Note rows */
[data-collection-item][data-line-kind="note"] {
  background: #fffbeb;
  box-shadow: inset 3px 0 0 #f59e0b;
}

[data-collection-item][data-line-kind="note"] .line-cell--num,
[data-collection-item][data-line-kind="note"] .line-cell--amount {
  display: none;
}

[data-collection-item][data-line-kind="note"] .line-cell--desc {
  grid-column: 2;
}

[data-collection-item][data-line-kind="note"] .line-remove {
  grid-column: 7;
}

[data-collection-item][data-line-kind="note"] .line-input,
[data-collection-item][data-line-kind="note"] .text-only-line-input {
  font-style: italic;
  color: #92400e;
  font-size: 0.85rem;
  text-align: left;
}

/* Hide the textarea for section/note, show text-only input */
[data-collection-item][data-line-kind="section"] .line-cell--desc > textarea,
[data-collection-item][data-line-kind="note"] .line-cell--desc > textarea {
  display: none;
}

.text-only-line-input.line-input {
  border: none;
  background: transparent;
  outline: none;
  display: block;
}

.text-only-line-input.line-input:focus {
  background: rgba(108, 71, 255, 0.04);
  outline: 2px solid rgba(108, 71, 255, 0.22);
  outline-offset: -2px;
  border-radius: 4px;
}

/* Section subtotal inside grid row */
.line-row .section-subtotal {
  grid-column: 1 / -1;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 38px 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
  margin-top: 0;
}

/* Add bar */
.line-add-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.line-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px dashed rgba(22, 35, 31, 0.25);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.13s, color 0.13s, background 0.13s;
  text-decoration: none;
  white-space: nowrap;
}

.line-add-btn:hover {
  border-color: rgba(22, 35, 31, 0.55);
  border-style: solid;
  color: var(--ink);
  background: rgba(22, 35, 31, 0.04);
}

.line-add-btn--primary {
  border-style: solid;
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.line-add-btn--primary:hover {
  background: rgba(22, 35, 31, 0.82);
  border-color: rgba(22, 35, 31, 0.82);
  color: #fff;
}

.line-add-btn--ai {
  border-style: solid;
  border-color: rgba(108, 71, 255, 0.38);
  color: #6c47ff;
}

.line-add-btn--ai:hover {
  background: rgba(108, 71, 255, 0.07);
  border-color: #6c47ff;
}

/* Catalog picker inside new layout */
.line-editor .catalog-picker {
  margin-top: 0;
}

/* État vide */
.line-empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 52px 24px;
  text-align: center;
}

.line-items:not(:has([data-collection-item])) .line-empty-state {
  display: flex;
}

.line-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px dashed #a78bfa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #a78bfa;
  line-height: 1;
  font-weight: 300;
  background: rgba(108, 71, 255, 0.04);
}

.line-empty-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #7c3aed;
  margin: 0;
}

.line-empty-sub {
  font-size: 0.78rem;
  color: #9ca3af;
  max-width: 280px;
  line-height: 1.5;
}

/* Masque l'en-tête quand vide */
.line-table:not(:has([data-collection-item])) .line-head {
  display: none;
}

/* Mobile */
@media (max-width: 640px) {
  .line-head { display: none; }

  .line-row {
    grid-template-columns: 24px 1fr 28px;
    grid-template-rows: auto;
  }

  .line-cell--desc {
    grid-column: 2 / 3;
  }

  .line-cell--num,
  .line-cell--amount {
    grid-column: 2 / 3;
    border-left: none;
    border-top: 1px solid rgba(22, 35, 31, 0.05);
  }

  .line-cell--amount {
    justify-content: flex-start;
    padding-left: 10px;
  }

  [data-collection-item][data-line-kind="section"] .line-cell--desc,
  [data-collection-item][data-line-kind="note"] .line-cell--desc {
    grid-column: 2 / 3;
  }

  [data-collection-item][data-line-kind="section"] .line-remove,
  [data-collection-item][data-line-kind="note"] .line-remove {
    grid-column: 3;
    grid-row: 1;
  }
}
