/* SOFT COMPTA - Feuille de style
   Direction: le registre comptable belge. La grille TVA est numerotee par la loi,
   donc la numerotation est ici porteuse de sens, pas decorative.
   Signature: la pastille de grille, un code monospace accroche a chaque montant. */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400..700;1,400..600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #14171C;
  --ink-2: #454C57;
  --ink-3: #737C89;
  --paper: #EFF1F4;
  --surface: #FFFFFF;
  --rail: #1B2027;
  --rail-2: #262E38;
  --rail-line: #333C48;
  --cobalt: #1F4FD8;
  --cobalt-soft: #E8EDFC;
  --sand: #A8761C;
  --sand-soft: #FBF1DD;
  --settled: #17715F;
  --settled-soft: #E1F0EC;
  --alert: #A63A28;
  --alert-soft: #FBE9E5;
  --line: #DBE0E7;
  --line-2: #EAEDF1;

  --r-sm: 4px;
  --r: 8px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(20, 23, 28, .05), 0 8px 24px -12px rgba(20, 23, 28, .18);

  --sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --rail-w: 244px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------- Layout ---------------- */

.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }

.rail {
  background: var(--rail);
  color: #E7EBF0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.rail__brand { padding: 22px 20px 18px; border-bottom: 1px solid var(--rail-line); }

.rail__wordmark {
  font-size: 15px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: #fff;
}

.rail__phase {
  margin-top: 5px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .04em; color: #7E8A99;
}

.rail__entity { padding: 16px 20px; border-bottom: 1px solid var(--rail-line); }

.rail__entity-name { font-size: 13px; font-weight: 600; color: #fff; }

.rail__entity-form {
  font-size: 11.5px; color: #8B96A5; margin-top: 2px;
}

.vat-chip {
  margin-top: 10px; display: flex; align-items: center; gap: 7px;
  background: var(--rail-2); border: 1px solid var(--rail-line);
  border-radius: var(--r); padding: 7px 9px;
}

.vat-chip__num {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  color: #DCE3EB; letter-spacing: -.01em;
}

.vat-chip__dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.vat-chip__dot--ok   { background: #3FBF9C; box-shadow: 0 0 0 3px rgba(63,191,156,.16); }
.vat-chip__dot--bad  { background: #E2705A; box-shadow: 0 0 0 3px rgba(226,112,90,.16); }

.rail__nav { padding: 12px 12px; flex: 1; overflow-y: auto; }

.rail__group {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: #6E7A89; padding: 14px 8px 7px;
}

.navlink {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: var(--r);
  background: transparent; color: #B9C3CF; cursor: pointer;
  font-size: 13.5px; transition: background .13s, color .13s;
}
.navlink:hover { background: var(--rail-2); color: #EAEFF4; }
.navlink[aria-current="page"] { background: var(--cobalt); color: #fff; font-weight: 600; }
.navlink:focus-visible { outline: 2px solid #7FA3FF; outline-offset: 2px; }

.navlink__count {
  font-family: var(--mono); font-size: 11px;
  background: rgba(255,255,255,.11); border-radius: 20px; padding: 1px 7px;
}
.navlink[aria-current="page"] .navlink__count { background: rgba(255,255,255,.22); }

.navlink--soon { opacity: .42; cursor: default; }
.navlink--soon:hover { background: transparent; color: #B9C3CF; }

.rail__foot {
  padding: 12px 20px 16px; border-top: 1px solid var(--rail-line);
  font-family: var(--mono); font-size: 10.5px; color: #6E7A89;
}

/* ---------------- Main ---------------- */

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 30px; height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}

.topbar__title { font-size: 17px; font-weight: 650; letter-spacing: -.012em; }
.topbar__sub { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }

.view { padding: 26px 30px 60px; max-width: 1180px; width: 100%; }

/* ---------------- Deadline banner ---------------- */

.deadline {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--sand);
  border-radius: var(--r); padding: 14px 18px; margin-bottom: 22px;
}

.deadline__count {
  font-family: var(--mono); font-size: 26px; font-weight: 600;
  letter-spacing: -.03em; line-height: 1; color: var(--sand);
}

.deadline__unit {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 3px;
}

.deadline__text { font-size: 13.5px; }
.deadline__text strong { font-weight: 650; }
.deadline__note { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------------- Cards ---------------- */

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

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px;
}

.card__label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .11em;
  text-transform: uppercase; color: var(--ink-3);
}

.card__value {
  font-family: var(--mono); font-size: 27px; font-weight: 600;
  letter-spacing: -.035em; margin-top: 9px; font-variant-numeric: tabular-nums;
}

.card__foot { font-size: 12.5px; color: var(--ink-3); margin-top: 7px; }

/* Signature: la pastille de grille TVA */
.box-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  background: var(--cobalt-soft); color: var(--cobalt);
  border-radius: var(--r-sm); padding: 2px 6px; vertical-align: 2px;
  letter-spacing: .02em;
}
.box-tag::before {
  content: ''; width: 3px; height: 9px; border-radius: 1px; background: currentColor; opacity: .5;
}
.box-tag--sand { background: var(--sand-soft); color: var(--sand); }
.box-tag--settled { background: var(--settled-soft); color: var(--settled); }

/* ---------------- Section ---------------- */

.section { margin-top: 30px; }

.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 12px;
}

.section__title { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.section__hint { font-size: 12.5px; color: var(--ink-3); }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r); padding: 8px 14px;
  font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: background .13s, border-color .13s, transform .06s;
}
.btn:hover { background: #F7F8FA; border-color: #C6CDD6; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }

.btn--primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn--primary:hover { background: #1A44BE; border-color: #1A44BE; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: #EDF0F4; }
.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------------- Forms ---------------- */

.field { margin-bottom: 15px; }

.field__label {
  display: block; font-size: 12.5px; font-weight: 600;
  margin-bottom: 5px; color: var(--ink-2);
}

.field__hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

.input, .select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r);
  padding: 9px 11px; background: var(--surface);
  transition: border-color .13s, box-shadow .13s;
}
.input:focus, .select:focus {
  outline: 0; border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(31,79,216,.13);
}
.input--mono { font-family: var(--mono); letter-spacing: -.01em; }
.input[aria-invalid="true"] { border-color: var(--alert); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(166,58,40,.13); }

.row { display: grid; gap: 14px; }
.row--2 { grid-template-columns: 1fr 1fr; }
.row--3 { grid-template-columns: 1fr 1fr 1fr; }

/* Bloc de verification TVA en direct */
.vat-verify {
  margin-top: 9px; border-radius: var(--r); padding: 11px 13px;
  border: 1px solid var(--line-2); background: #F7F8FA;
  font-size: 12.5px; display: none;
}
.vat-verify[data-state] { display: block; }
.vat-verify[data-state="ok"]      { background: var(--settled-soft); border-color: #BFDDD6; }
.vat-verify[data-state="bad"]     { background: var(--alert-soft);   border-color: #EEC6BD; }
.vat-verify[data-state="warn"]    { background: var(--sand-soft);    border-color: #E8D3A8; }

.vat-verify__head { font-weight: 650; display: flex; align-items: center; gap: 7px; }

.vat-verify__math {
  font-family: var(--mono); font-size: 11.5px; margin-top: 7px;
  color: var(--ink-2); line-height: 1.7;
}
.vat-verify__math b { font-weight: 600; color: var(--ink); }

/* ---------------- Table ---------------- */

.table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  font-weight: 500; padding: 11px 16px; border-bottom: 1px solid var(--line);
  background: #FAFBFC;
}

td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAFBFC; }

.t-num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.t-right { text-align: right; }
.t-name { font-weight: 600; }
.t-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

/* ---------------- Pills ---------------- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; border-radius: 20px; padding: 3px 9px;
  background: var(--line-2); color: var(--ink-2);
}
.pill--ok    { background: var(--settled-soft); color: var(--settled); }
.pill--warn  { background: var(--sand-soft);    color: var(--sand); }
.pill--bad   { background: var(--alert-soft);   color: var(--alert); }
.pill--info  { background: var(--cobalt-soft);  color: var(--cobalt); }

.pill__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.brand-tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 1px 6px;
}

/* ---------------- Empty ---------------- */

.empty { padding: 52px 24px; text-align: center; }
.empty__title { font-size: 15px; font-weight: 650; }
.empty__text { font-size: 13px; color: var(--ink-3); margin: 6px auto 16px; max-width: 380px; }

/* ---------------- Drawer ---------------- */

.scrim {
  position: fixed; inset: 0; background: rgba(20,23,28,.34);
  opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 40;
}
.scrim[data-open] { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--surface); z-index: 50; box-shadow: var(--shadow);
  transform: translateX(100%); transition: transform .22s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.drawer[data-open] { transform: none; }

.drawer__head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer__title { font-size: 15.5px; font-weight: 650; }
.drawer__body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.drawer__foot {
  padding: 14px 22px; border-top: 1px solid var(--line);
  display: flex; gap: 9px; justify-content: flex-end;
}

/* ---------------- Toast ---------------- */

.toasts {
  position: fixed; bottom: 22px; right: 22px; z-index: 60;
  display: flex; flex-direction: column; gap: 9px;
}

.toast {
  background: var(--rail); color: #EAEFF4; border-radius: var(--r);
  padding: 11px 15px; font-size: 13px; box-shadow: var(--shadow);
  max-width: 340px; animation: rise .2s cubic-bezier(.4,0,.2,1);
}
.toast--bad { background: var(--alert); }
.toast--ok  { background: var(--settled); }

@keyframes rise { from { opacity: 0; transform: translateY(9px); } }

/* ---------------- Boot error ---------------- */

.boot-error {
  max-width: 560px; margin: 12vh auto; background: var(--surface);
  border: 1px solid var(--alert); border-top: 3px solid var(--alert);
  border-radius: var(--r-lg); padding: 28px;
}
.boot-error__title { font-size: 17px; font-weight: 700; color: var(--alert); }
.boot-error__body { margin-top: 10px; font-size: 13.5px; line-height: 1.65; }
.boot-error__math {
  font-family: var(--mono); font-size: 12.5px; background: #FAFBFC;
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 15px; margin-top: 15px; line-height: 1.8;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .rail__nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .rail__group { display: none; }
  .navlink { width: auto; }
  .grid--3, .grid--2, .row--2, .row--3 { grid-template-columns: 1fr; }
  .view, .topbar { padding-left: 18px; padding-right: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
