/* L'heure facturée : feuille de saisie claire et instrument de lecture nuit. */
#horaire-app { --h-net: #F5FAFD; --h-social: #8EB1C9; --h-fees: #526C80; font-variant-numeric: tabular-nums; }
#horaire-app h3 { font-size: 1.25rem; font-weight: 650; letter-spacing: -.02em; margin: 0 0 1.5rem; }
#horaire-app h4 { font-size: 1rem; margin: 0 0 1rem; font-weight: 600; }
#horaire-app p { max-width: 70ch; }
#horaire-app .workspace-heading { border-bottom: 1px solid var(--line); }
.h-workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
#h-form { padding: 2rem; background: var(--paper); min-width: 0; }
#h-form h3:not(:first-child) { margin-top: 2rem; }
.h-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1rem; }
.h-fields > *, .h-workbench > * { min-width: 0; }
#horaire-app .field input, #horaire-app .field select { min-height: 48px; }
#h-netMensuel { font-size: 1.5rem; font-weight: 600; letter-spacing: -.025em; }
.h-fees-link { align-self: center; padding-left: 1rem; border-left: 2px solid var(--line); }
.h-fees-link > * { display: block; }
.h-fees-link span { font-size: .875rem; color: var(--muted); }
.h-fees-link strong { font-size: 1.25rem; font-weight: 600; white-space: nowrap; }
.h-fees-link a { display: inline-flex; align-items: center; min-height: 44px; color: var(--cyan-ink); font-size: .75rem; }
.h-more { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
#h-more { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; text-align: left; background: #fff; border-color: var(--control); padding: .75rem 1rem; }
#h-more:hover { background: #E4F3F7; }
.h-chevron { display: inline-block; width: .5rem; height: .5rem; flex-shrink: 0; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
#h-more[aria-expanded="true"] .h-chevron { transform: rotate(225deg); }
#h-more:focus-visible, #comparatif button:focus-visible { outline: 3px solid var(--cyan-ink); outline-offset: 3px; }
#h-settings-summary { margin: .5rem 0 0; color: var(--muted); font-size: .75rem; }
#h-advanced { padding-top: 1.5rem; }
.h-result { color: var(--paper); background: var(--night-2); padding: 2rem; min-width: 0; }
#horaire-app .h-result h3 { margin-bottom: .5rem; }
.h-result :focus-visible { outline-color: var(--cyan); }
#h-selected { color: var(--muted-dark); font-size: .875rem; margin: 0; }
.h-state { min-height: 3rem; color: var(--muted-dark); font-size: .75rem; margin: 1rem 0; display: flex; align-items: center; gap: .5rem; }
[data-state="loading"] .h-state::before, [data-state="computing"] .h-state::before { content: ''; width: .75rem; height: .75rem; flex: 0 0 .75rem; border: 2px solid var(--muted-dark); border-top-color: var(--cyan); border-radius: 50%; animation: h-turn 1s linear infinite; }
@keyframes h-turn { to { transform: rotate(360deg); } }
[data-state="error"] .h-state, [data-state="invalid"] .h-state { color: var(--paper); border-left: 3px solid var(--violet); padding-left: 1rem; }
#h-result-values { transition: opacity .15s; }
[data-state="computing"].h-main-pending #h-result-values { opacity: .8; }
#h-mobile-bar { display: none; }
#h-mobile-values { min-width: 0; transition: opacity .15s; }
[data-state="computing"].h-main-pending #h-mobile-values { opacity: .8; }
#h-result { scroll-margin-top: 1rem; }
.h-prices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
.h-label { color: var(--muted-dark); margin: 0; font-size: .875rem; }
.h-price { font-size: clamp(3rem, 5.8vw, 6rem); line-height: 1.1; letter-spacing: -.065em; font-weight: 650; margin: .5rem 0; white-space: nowrap; }
.h-price.h-price-long { font-size: clamp(2rem, 3.5vw, 4rem); }
.h-price.h-price-very-long { font-size: clamp(1.125rem, 2vw, 2rem); letter-spacing: -.035em; }
#h-ttc, #h-no-vat { margin: .5rem 0 0; color: var(--muted-dark); font-size: .875rem; }
#h-ttc strong { color: var(--paper); font-size: 1.25rem; font-weight: 550; }
.h-cost { border-left: 3px solid var(--cyan); padding-left: 1rem; }
.h-cost > strong { display: block; font-size: 1.5rem; font-weight: 550; margin-top: .5rem; }
.h-cost > p:last-child { margin: .25rem 0 0; font-size: .75rem; color: var(--muted-dark); }
.h-durations { display: flex; flex-wrap: wrap; gap: 1rem 2rem; padding-block: 1.5rem; margin-top: 1.5rem; border-block: 1px solid var(--dark-line); }
.h-durations p { margin: 0 0 .5rem; font-size: .75rem; color: var(--muted-dark); }
.h-durations strong { font-size: 1.25rem; font-weight: 550; }
.h-durations span { font-size: .875rem; }
#horaire-app [data-out], .h-legend dd { white-space: nowrap; }
.h-breakdown { margin: 2rem 0; }
.h-breakdown figcaption { font-size: 1.25rem; font-weight: 600; letter-spacing: -.025em; }
.h-breakdown figcaption span { display: block; margin-top: .5rem; font-size: .75rem; font-weight: 400; color: var(--muted-dark); letter-spacing: normal; }
.h-bar { display: flex; width: 100%; height: 48px; margin: 1rem 0 1.5rem; border-radius: 4px; overflow: hidden; }
.h-segment { display: block; flex-shrink: 0; border-right: 2px solid var(--night-2); }
.h-seg-net, .h-key-net::before { background: var(--h-net); }
.h-seg-social, .h-key-social::before { background: repeating-linear-gradient(135deg, #8EB1C9 0 4px, #08182A 4px 6px); }
.h-seg-fees, .h-key-fees::before { background: var(--h-fees); }
.h-seg-margin, .h-key-margin::before { background: var(--cyan); }
.h-basis-vente .h-seg-margin, .h-basis-vente .h-key-margin::before { background: var(--violet); }
.h-seg-vat, .h-key-vat::before { background: repeating-linear-gradient(90deg, #8EB1C9 0 2px, #08182A 2px 5px); }
.h-legend { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.h-key { position: relative; padding-left: 1.5rem; min-width: 0; }
.h-key::before { content: ''; width: .75rem; height: .75rem; position: absolute; left: 0; top: .25rem; border: 1px solid var(--muted-dark); }
.h-legend dt { font-size: .75rem; color: var(--muted-dark); }
.h-legend dd { margin: .25rem 0 0; font-size: 1.25rem; font-weight: 550; }
.h-fine { color: var(--muted-dark); font-size: .75rem; line-height: 1.6; margin: 1rem 0 0; }
.h-year { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--dark-line); }
.h-year dl { margin: 0; }
.h-year dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; padding-block: .5rem; }
.h-year dt { color: var(--muted-dark); font-size: .75rem; max-width: 32ch; }
.h-year dd { margin: 0; font-size: .875rem; }
.h-year-total { border-top: 1px solid var(--dark-line); margin-top: .5rem; }
.h-year-total dd { font-weight: 650; }
.h-net-cost { margin: 1rem 0 0; font-size: .875rem; }
.h-net-cost strong { color: var(--cyan); }
.h-net-cost span { color: var(--muted-dark); font-size: .75rem; }
.h-alert { border-left: 3px solid var(--violet); padding: .5rem 1rem; margin: 1.5rem 0 0; font-size: .875rem; }
.h-alert p { margin: 0 0 .5rem; }
.h-alert p:last-child { margin-bottom: 0; }
.h-fees, .h-comparison { padding: 2rem; border-top: 1px solid var(--line); }
.h-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; }
#horaire-app .h-section-heading h3 { margin-bottom: .5rem; }
.h-section-heading p, .h-comparison-note { font-size: .875rem; color: var(--muted); margin: 0; }
.h-section-heading button { flex-shrink: 0; }
#h-frais-title { scroll-margin-top: 1rem; }
#h-fees-table, #comparatif { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .875rem; }
#h-fees-table th, #comparatif th { text-align: left; }
#h-fees-table thead th, #comparatif thead th { color: var(--muted); font-size: .75rem; font-weight: 550; padding: 1rem .5rem; vertical-align: bottom; border-bottom: 1px solid var(--line); }
#h-fees-table td, #comparatif td, #comparatif tbody th { padding: 1rem .5rem; border-bottom: 1px solid var(--line); }
#h-fees-table thead th:first-child { width: 44%; }
#h-fees-table thead th:last-child { width: 48px; }
#h-fees-table input, #h-fees-table select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--control); border-radius: 4px; background: #fff; color: var(--night-2); padding: .5rem; font-size: 1rem; }
#h-fees-table [name="fraisMontant"] { text-align: right; }
#h-fees-table .h-fee-annual, #h-fees-total { white-space: nowrap; text-align: right; }
#h-fees-table .h-fee-delete { padding-inline: 0; }
.h-fee-delete button { width: 44px; height: 44px; font-size: 1.5rem; padding: 0; border-color: transparent; background: transparent; color: var(--muted); }
.h-fee-delete button:hover { background: var(--paper); color: var(--night-2); }
#h-fees-table tfoot th, #h-fees-table tfoot td { background: var(--paper); padding: 1rem .5rem; font-weight: 650; border-bottom: 0; }
.h-mobile-label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
#comparatif caption { text-align: left; color: var(--muted); font-size: .75rem; padding: 0 0 1rem; }
#comparatif thead th:first-child { width: 25%; }
#comparatif thead th:nth-child(2) { width: 15%; }
#comparatif thead th:nth-child(n+3) { text-align: right; }
#comparatif .h-amount { text-align: right; white-space: nowrap; }
#comparatif [data-col="prixHT"] { font-size: 1.25rem; font-weight: 650; color: var(--cyan-ink); }
#comparatif tbody tr { cursor: pointer; }
#comparatif tbody tr:hover { background: var(--paper); }
#comparatif tbody tr.is-selected { background: #E4F3F7; }
#comparatif tbody tr.is-selected > th { box-shadow: inset 3px 0 var(--cyan-ink); }
#comparatif button { border: 0; background: transparent; text-align: left; font-weight: 550; padding: .5rem; width: 100%; overflow-wrap: anywhere; }
#comparatif button:hover { background: #E4F3F7; }
.h-choose { display: flex; align-items: center; gap: .5rem; font-size: .75rem; color: var(--cyan-ink); margin-top: .25rem; }
.h-choose .h-chevron { transform: rotate(-45deg); }
.h-chosen { display: block; font-size: .75rem; color: var(--cyan-ink); margin-top: .25rem; font-weight: 650; }
.h-protection { color: var(--muted); font-size: .75rem; }
.h-comparison-note { margin-top: 1.5rem; }
.h-actions { padding: 0 2rem 1.5rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
#h-storage-note { color: var(--muted); font-size: .75rem; margin: 0; }
/* Cette feuille est propre à la page : le guide protégé garde tous ses mots. */
.guide { grid-template-columns: minmax(0, 1fr); max-width: 1000px; }
.guide article { max-width: 100%; }
.guide article > p, .guide article > ul, .guide article > ol, .guide details { max-width: 75ch; }
.guide table { table-layout: fixed; }
.guide td, .guide th { overflow-wrap: anywhere; }
@media (min-width: 1400px) {
  .h-prices { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1rem; align-items: end; }
  .h-price { font-size: 4.5rem; }
  .h-price.h-price-long { font-size: 2.5rem; }
  .h-price.h-price-very-long { font-size: 1.125rem; }
}
@media (max-width: 1100px) {
  .h-workbench { grid-template-columns: minmax(0, 1fr); }
  .h-result { padding: 2rem; }
  .h-prices { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: end; }
  .h-price { font-size: 5rem; }
  .h-year dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 2rem; }
  .h-year dl > div { display: block; }
  .h-year dd { margin-top: .25rem; }
}
@media (max-width: 980px) {
  #h-fees-table, #comparatif { display: block; min-width: 0; table-layout: auto; }
  #h-fees-table thead, #comparatif thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  #h-fees-table tbody, #h-fees-table tfoot, #comparatif tbody { display: block; }
  #h-fees-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; border-top: 1px solid var(--line); padding: 1.5rem 0; position: relative; }
  #h-fees-table tbody td, #comparatif tbody td, #comparatif tbody th { display: block; width: auto; min-width: 0; border: 0; padding: 0; }
  #h-fees-table tbody td[class], #comparatif tbody td[class] { width: auto; min-width: 0; }
  #h-fees-table .h-fee-label { grid-column: 1 / -1; }
  #h-fees-table .h-fee-label label { min-height: 44px; display: flex; align-items: center; padding-right: 3rem; }
  #h-fees-table .h-fee-delete { position: absolute; right: 0; top: 1.5rem; }
  .h-mobile-label { display: block; position: static; width: auto; height: auto; clip-path: none; overflow: visible; white-space: normal; font-size: .75rem; color: var(--muted); margin-bottom: .5rem; text-align: left; }
  #h-fees-table .h-fee-annual { align-self: end; padding-bottom: .5rem; }
  #h-fees-table .h-fee-annual .h-mobile-label { text-align: right; }
  #h-fees-table tfoot tr { display: flex; justify-content: space-between; flex-wrap: wrap; background: var(--paper); }
  #h-fees-table tfoot td:last-child { display: none; }
  #comparatif caption { display: block; }
  #comparatif tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  #comparatif tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: 8px; }
  #comparatif tbody th, #comparatif .h-protection { grid-column: 1 / -1; }
  #comparatif tbody tr.is-selected { border-color: var(--cyan-ink); }
  #comparatif tbody tr.is-selected > th { box-shadow: none; }
  #comparatif button { padding: 0; }
  #comparatif td::before { content: attr(data-label); display: block; white-space: normal; font-size: .75rem; font-weight: 400; color: var(--muted); margin-bottom: .25rem; }
  #comparatif .h-protection::before { display: none; }
  #comparatif .h-amount { text-align: left; }
  #comparatif [data-col="prixHT"] { font-size: 1.25rem; }
}
@media (max-width: 979.98px) {
  #horaire-app.h-mobile-visible { padding-bottom: var(--h-mobile-height, 8rem); }
  #h-mobile-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; position: fixed; z-index: 4; bottom: 0; left: 0; right: 0; padding: .75rem max(1rem, env(safe-area-inset-right)) calc(.75rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); color: var(--paper); background: var(--night-2); border-top: 1px solid var(--muted-dark); }
  #h-mobile-bar p { margin: 0; }
  .h-mobile-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .5rem; }
  .h-mobile-price strong { font-size: 1.75rem; line-height: 1.2; font-weight: 650; letter-spacing: -.025em; }
  .h-mobile-price strong.h-price-long { font-size: 1rem; }
  .h-mobile-price span, .h-mobile-cost { color: var(--muted-dark); font-size: .75rem; }
  #h-mobile-bar [data-mirror] { white-space: nowrap; }
  #h-mobile-bar a { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; text-decoration-color: var(--cyan); }
  #h-mobile-bar a:focus-visible { outline-color: var(--cyan); }
}
@media (max-width: 760px) {
  #comparatif tbody { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  #h-form, .h-result, .h-fees, .h-comparison { padding: 1.5rem 1rem; }
  .h-fields, .h-prices { grid-template-columns: minmax(0, 1fr); }
  .h-fields { gap: 1.5rem; }
  .h-price { font-size: 3.5rem; }
  .h-price.h-price-long { font-size: 2rem; }
  .h-price.h-price-very-long { font-size: 1.125rem; }
  .h-fees-link { padding: 1rem; background: #E4F3F7; border: 0; border-radius: 4px; }
  .h-legend { gap: 1rem; }
  .h-legend dd { font-size: 1rem; }
  .h-year dl { display: block; }
  .h-year dl > div { display: flex; }
  .h-year dt { max-width: 22ch; }
  .h-section-heading { display: block; }
  .h-section-heading button { margin-top: 1rem; }
  #h-fees-table tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #h-fees-table .h-fee-annual { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
  #h-fees-table .h-fee-annual .h-mobile-label { margin: 0; }
  #comparatif tbody { grid-template-columns: minmax(0, 1fr); }
  #comparatif tbody tr { padding: 1rem; }
  #comparatif tbody tr.h-long-amounts { grid-template-columns: minmax(0, 1fr); }
  #comparatif tr.h-long-amounts [data-col="prixHT"] { font-size: 1rem; }
  .h-actions { padding: 0 1rem 1.5rem; }
  .guide table { font-size: .75rem; }
  .guide th, .guide td { padding-inline: .25rem; }
}
@media (prefers-reduced-motion: reduce) {
  #horaire-app *, #horaire-app *::before { animation: none !important; transition: none !important; }
}
@media print {
  #h-mobile-bar { display: none !important; }
  #horaire-app.h-mobile-visible { padding-bottom: 0; }
  #horaire-app, #horaire-app .h-result, #horaire-app .h-fees, #horaire-app .h-comparison { color: #000; background: #fff; }
  #horaire-app * { color: #000 !important; border-color: #888 !important; }
  #horaire-app .h-workbench { display: block; }
  #h-form, #horaire-app .h-fees, #horaire-app .h-actions { display: none !important; }
  #h-state { min-height: 0; font-size: 9pt; }
  #h-state::before { display: none; }
  #h-result-values { opacity: 1 !important; }
  #horaire-app .h-result, #horaire-app .h-comparison { padding: 1rem 0; }
  #horaire-app .h-prices { display: flex; gap: 3rem; }
  #horaire-app .h-price { font-size: 32pt; }
  #horaire-app .h-price-long { font-size: 22pt; }
  #horaire-app .h-price-very-long { font-size: 12pt; }
  #horaire-app .h-breakdown { break-inside: avoid; }
  #horaire-app .h-bar { border: 1px solid #000; print-color-adjust: exact; }
  #horaire-app .h-legend { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #horaire-app .h-year dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 2rem; }
  #horaire-app #comparatif { display: table; table-layout: fixed; width: 100%; font-size: 8pt; }
  #horaire-app #comparatif caption { display: table-caption; }
  #horaire-app #comparatif thead { display: table-header-group; position: static; width: auto; height: auto; clip-path: none; }
  #horaire-app #comparatif tbody { display: table-row-group; }
  #horaire-app #comparatif tbody tr { display: table-row; background: #fff; }
  #horaire-app #comparatif tbody th, #horaire-app #comparatif tbody td { display: table-cell; border-bottom: 1px solid #888; padding: .5rem .25rem; width: auto; font-size: 8pt; }
  #horaire-app #comparatif td::before { display: none; }
  /* Le bouton sert aussi de libellé de ligne : son texte est dupliqué pour l'impression. */
  #horaire-app #comparatif tbody th::before { content: attr(data-print-label); font-weight: 550; }
  #h-print-summary { display: block; font-size: 9pt; padding: 1rem 0; border-top: 1px solid #888; }
  #horaire-app .h-chosen { display: none; }
}
