/* =====================================================================================
   ESPACE CLIENT — affichage
   =====================================================================================
   Les couleurs et les polices viennent de lib/design-tokens.css, servi sur
   /design-tokens.css. Aucune couleur n'est ecrite en dur ici : c'est ce qui garantit
   que l'espace client et le site public restent la meme marque. Avant le 06/08/2026,
   ce fichier portait sa propre palette vert-sarcelle, sans rapport avec le site.

   Les choix de structure d'origine sont conserves, parce qu'ils sont justes :
   un artisan consulte son espace depuis un chantier, d'une seule main, souvent en plein
   soleil. D'ou gros contrastes, grandes zones tactiles, une seule colonne, et les
   onglets en bas de l'ecran — la ou le pouce arrive.
   ===================================================================================== */

:root {
  --radius: 14px;
  --tap: 46px;

  /* Roles d'affichage, tous branches sur la palette de marque. */
  --fond:        var(--papier);
  --carte:       var(--blanc);
  --texte-fort:  var(--encre);
  --texte-doux:  var(--gris);
  --trait:       var(--bordure);
  --action:      var(--cuivre);
  --action-fond: #F6E7DF;
  --alerte:      #8A5A00;
  --alerte-fond: #FBF0DC;
  --peril:       var(--rouge);
}

/* Mode sombre. La regle du fichier de palette est respectee a la lettre :
   « --ocre : surlignage UNIQUEMENT sur fond encre ». Le cuivre, lui, n'a pas
   un contraste suffisant sur l'encre — on ne le reprend donc pas ici. */
@media (prefers-color-scheme: dark) {
  :root {
    --fond:        var(--encre);
    --carte:       var(--encre-doux);
    --texte-fort:  var(--papier);
    --texte-doux:  var(--gris-clair);
    --trait:       #2C4C4A;
    --action:      var(--ocre);
    --action-fond: #24413F;
    --alerte:      var(--ocre);
    --alerte-fond: #33291A;
    --peril:       #F2A09A;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--fond);
  color: var(--texte-fort);
  font-family: var(--texte);
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

#app { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: var(--carte);
  border-bottom: 1px solid var(--trait);
}

/* Le nom de la marque se lit dans la police des titres, comme sur le site. */
.topbar h1 {
  font-family: var(--titre);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.13em;
  margin: 0;
  flex: 1;
  text-transform: uppercase;
}

.banner {
  margin: 0;
  padding: 9px 16px;
  background: var(--ocre);
  color: var(--encre);
  font-size: 13px;
  font-weight: 600;
}

main { padding: 18px 16px; max-width: 900px; margin: 0 auto; }

h2 { font-family: var(--titre); font-weight: 600; font-size: 27px; line-height: 1.14;
     letter-spacing: -0.01em; margin: 6px 0 4px; }
h3 { font-family: var(--titre); font-weight: 600; font-size: 18.5px; margin: 0 0 5px; }
p.subtitle { color: var(--texte-doux); margin: 0 0 18px; font-size: 15.5px; }

.card {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--radius);
  padding: 17px;
  margin-bottom: 14px;
}

.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.metric {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--radius);
  padding: 15px;
}
/* Un chiffre se lit dans la police des titres : c'est ce qui donne au rapport
   mensuel l'allure d'un releve, et pas d'un tableau de bord de logiciel. */
.metric .value { font-family: var(--titre); font-size: 33px; font-weight: 600; line-height: 1.05;
                 font-variant-numeric: tabular-nums; }
.metric .label { font-size: 14px; color: var(--texte-doux); margin-top: 5px; }
.metric .basis { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
                 margin-top: 9px; color: var(--texte-doux); font-weight: 700; }
/* Le trait interrompu dit « estimation », et le dit sans mot supplementaire. */
.metric.estimation { border-style: dashed; }
.metric.headline .value { color: var(--action); }

.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--action-fond);
  color: var(--action);
  border: 1px solid transparent;
}
.pill.muted { background: transparent; color: var(--texte-doux); border-color: var(--trait); }
.pill.warn { background: var(--alerte-fond); color: var(--alerte); }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }

button {
  min-height: var(--tap);
  padding: 11px 17px;
  border-radius: 11px;
  border: 1px solid var(--trait);
  background: var(--carte);
  color: var(--texte-fort);
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
}
button:hover { border-color: var(--action); color: var(--action); }
button.primary { background: var(--cuivre); border-color: var(--cuivre); color: var(--blanc); font-weight: 700; }
button.primary:hover { background: var(--cuivre-fonce); border-color: var(--cuivre-fonce); color: var(--blanc); }
button.danger { color: var(--peril); border-color: var(--peril); }
button.danger:hover { color: var(--peril); border-color: var(--peril); }
button.link { border: none; background: none; color: var(--action); padding: 6px 0; min-height: 34px;
              text-decoration: underline; text-underline-offset: 3px; }
button[disabled] { opacity: 0.45; cursor: not-allowed; }
button[disabled]:hover { border-color: var(--trait); color: var(--texte-fort); }

/* Sans cette regle, la navigation au clavier avance a l'aveugle. */
button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 2px;
}

label { display: block; font-size: 15px; margin-bottom: 6px; font-weight: 500; }

input[type="text"], input[type="password"], input[type="number"], input[type="time"],
input[type="date"], input[type="email"], input[type="tel"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 13px;
  border: 1px solid var(--trait);
  border-radius: 11px;
  background: var(--fond);
  color: var(--texte-fort);
  font-size: 16px;
  font-family: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--action); }

.setting { padding: 15px 0; border-top: 1px solid var(--trait); }
.setting:first-child { border-top: none; }
.setting .hint { font-size: 13.5px; color: var(--texte-doux); margin-top: 6px; }
.setting.locked label::after { content: " 🔒"; }

.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 11px; min-height: 38px; }
.choice input { width: 22px; height: 22px; accent-color: var(--cuivre); }

.switch { display: flex; align-items: center; gap: 12px; }
.switch input { width: 26px; height: 26px; accent-color: var(--cuivre); }

.schedule-day { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; }
.schedule-day span { font-size: 14px; }
.schedule-day input[type="time"] { min-width: 104px; }

.list-editor .list-row { display: flex; gap: 8px; margin-bottom: 8px; }
.list-editor .list-row button { min-height: 40px; padding: 6px 12px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 11px 6px; border-bottom: 1px solid var(--trait); }
th { font-size: 12.5px; color: var(--texte-doux); font-weight: 700;
     text-transform: uppercase; letter-spacing: 0.05em; }
/* Des montants alignes se comparent d'un coup d'oeil ; en chasse variable, non. */
td { font-variant-numeric: tabular-nums; }

.service { margin-bottom: 14px; }
.service .price { font-size: 15px; color: var(--texte-doux); }

/* Encadre d'avertissement legal. Il sert aussi bien a une obligation liee a un service
   qu'a ce qui sera conserve malgre une suppression de compte: il ne depend donc pas
   d'etre place a l'interieur d'une carte de service. */
.legal {
  background: var(--alerte-fond);
  color: var(--alerte);
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 14px;
  margin-top: 10px;
  border-left: 3px solid var(--alerte);
}

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--carte);
  border-top: 1px solid var(--trait);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.tabbar button {
  flex: 1;
  border: none;
  border-radius: 0;
  background: none;
  padding: 8px 2px;
  min-height: 62px;
  font-size: 11px;
  color: var(--texte-doux);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.tabbar button:hover { color: var(--action); }
.tabbar button .icon { font-size: 17px; line-height: 1; }
.tabbar button[aria-current="true"] { color: var(--action); font-weight: 700; }
/* Le trait sous l'onglet courant : la couleur seule ne suffit pas a qui la distingue mal. */
.tabbar button[aria-current="true"]::before {
  content: ""; position: absolute; bottom: 0; width: 34px; height: 3px;
  background: var(--action); border-radius: 3px 3px 0 0;
}
.tabbar button { position: relative; }

.notice { padding: 13px 15px; border-radius: 11px; margin-bottom: 12px; font-size: 15px; }
.notice.ok { background: var(--action-fond); color: var(--action); }
.notice.error { background: var(--alerte-fond); color: var(--peril); }

.login { max-width: 420px; margin: 8vh auto; }

@media (min-width: 760px) {
  .metrics { grid-template-columns: repeat(4, 1fr); }
  #app { padding-bottom: 0; }
  .tabbar {
    position: sticky;
    top: 0;
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid var(--trait);
    max-width: 900px;
    margin: 0 auto;
  }
  .tabbar button { flex-direction: row; gap: 8px; font-size: 15px; min-height: 54px; }
  .tabbar button[aria-current="true"]::before { bottom: -1px; width: 100%; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
