/* =====================================================================
   ETAT AZ SOLAR — design tokens
   Palette derived from the AZ Solar sunburst mark: deep navy body,
   logo-blue accents, gold as the one warm/CTA color — never decorative,
   only where something is actionable or currently selected.
===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root{
  /* brand */
  --navy-950:#10142f;
  --navy-900:#1b2151;
  --navy-800:#292f66;
  --blue-600:#2f59ae;
  --blue-500:#5077c9;
  --indigo-400:#6b6fc9;
  --gold-500:#f8d20d;
  --gold-600:#dcb700;

  /* surface */
  --paper:#f6f6fb;
  --surface:#ffffff;
  --line:#e8e8f2;
  --line-strong:#d8d9ea;

  /* text */
  --ink-900:#181b32;
  --ink-600:#4d5170;
  --ink-400:#8386a3;

  /* status */
  --ok-600:#1f8a5c; --ok-bg:#e4f6ee;
  --warn-600:#c2481f; --warn-bg:#fbe8e0;
  --pend-600:#b4790c; --pend-bg:#fdf1dc;
  --purple-600:#7440a6; --purple-bg:#f1e7fa;

  /* geometry */
  --radius-sm:8px;
  --radius-md:14px;
  --radius-lg:22px;
  --shadow-sm:0 1px 2px rgba(16,20,47,.06), 0 1px 1px rgba(16,20,47,.04);
  --shadow-md:0 12px 32px rgba(16,20,47,.10), 0 2px 8px rgba(16,20,47,.06);
  --shadow-lg:0 30px 70px rgba(16,20,47,.28);

  --font-display:'Manrope', system-ui, sans-serif;
  --font-body:'Inter', system-ui, sans-serif;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family:var(--font-body);
  color:var(--ink-900);
  background:var(--paper);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,.brand-font{ font-family:var(--font-display); }
a{ color:var(--blue-600); }
.hidden{ display:none !important; }
button{ font-family:var(--font-body); }
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:var(--line-strong); border-radius:8px; }
:focus-visible{ outline:2.5px solid var(--blue-500); outline-offset:2px; }

/* =====================================================================
   PRIMITIVES — buttons, inputs, cards, pills — shared across all pages
===================================================================== */
.btn{
  display:inline-flex; align-items:center; gap:8px; justify-content:center;
  padding:10px 18px; border-radius:var(--radius-sm); font-size:13.5px; font-weight:700;
  cursor:pointer; border:1.5px solid transparent; transition:.18s cubic-bezier(.4,0,.2,1); white-space:nowrap;
  font-family:var(--font-body);
}
.btn:active{ transform:translateY(1px); }
.btn-gold{ background:linear-gradient(155deg, #ffdc3d, var(--gold-500)); color:#241a05; box-shadow:0 2px 10px rgba(248,210,13,.35); }
.btn-gold:hover{ background:linear-gradient(155deg, #ffe667, #ffd400); box-shadow:0 4px 16px rgba(248,210,13,.45); transform:translateY(-1px); }
.btn-navy{ background:linear-gradient(155deg, var(--blue-600), var(--navy-800)); color:#fff; }
.btn-navy:hover{ background:linear-gradient(155deg, var(--blue-500), var(--blue-600)); transform:translateY(-1px); }
.btn-line{ background:var(--surface); color:var(--ink-900); border-color:var(--line-strong); }
.btn-line:hover{ border-color:var(--blue-600); color:var(--blue-600); }
.btn-ghost{ background:transparent; color:var(--ink-600); }
.btn-ghost:hover{ background:var(--paper); color:var(--ink-900); }
.btn-danger-ghost{ background:transparent; color:var(--warn-600); }
.btn-danger-ghost:hover{ background:var(--warn-bg); }
.btn-sm{ padding:7px 12px; font-size:12.5px; }
.btn[disabled]{ opacity:.45; cursor:not-allowed; }

label.field-label{
  display:block; font-size:11px; font-weight:700; text-transform:uppercase;
  letter-spacing:.06em; color:var(--ink-400); margin-bottom:7px;
}
input[type=text],input[type=email],input[type=password],input[type=tel],
input[type=number],input[type=date],select,textarea{
  width:100%; padding:11px 13px; border:1.5px solid var(--line-strong); border-radius:var(--radius-sm);
  font-size:14px; font-family:var(--font-body); background:var(--surface); color:var(--ink-900);
  transition:.15s;
}
input:focus,select:focus,textarea:focus{ outline:none; border-color:var(--blue-600); box-shadow:0 0 0 4px rgba(47,89,174,.12); }
input::placeholder{ color:var(--ink-400); }

.card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-md); box-shadow:var(--shadow-sm); transition:box-shadow .2s, transform .2s; }

.pill{ font-size:10.5px; font-weight:700; padding:4px 10px; border-radius:20px; display:inline-block; letter-spacing:.02em; }
.pill-office{ background:#eef1fb; color:var(--navy-800); }
.pill-cours,.pill-encours,.pill-invited{ background:var(--pend-bg); color:var(--pend-600); }
.pill-recu,.pill-active,.pill-resolu{ background:var(--ok-bg); color:var(--ok-600); }
.pill-annule,.pill-ouvert,.pill-disabled{ background:var(--warn-bg); color:var(--warn-600); }
.pill-priority-basse{ background:#eef0f8; color:var(--ink-600); }
.pill-priority-normale{ background:var(--pend-bg); color:var(--pend-600); }
.pill-priority-haute{ background:#fde3d0; color:#b1490f; }
.pill-priority-urgente{ background:var(--warn-bg); color:var(--warn-600); font-weight:800; }
.pill-manager{ background:var(--purple-bg); color:var(--purple-600); }

.toast{
  position:fixed; bottom:24px; right:24px; z-index:200; background:var(--navy-900); color:#fff;
  padding:13px 20px; border-radius:var(--radius-sm); box-shadow:var(--shadow-md); font-size:13.5px; font-weight:600;
  display:flex; align-items:center; gap:10px; animation:toast-in .18s ease-out;
}
.toast.error{ background:#5c1f14; }
@keyframes toast-in{ from{ transform:translateY(8px); opacity:0; } to{ transform:translateY(0); opacity:1; } }

.spinner{
  width:16px; height:16px; border-radius:50%; border:2.5px solid rgba(255,255,255,.35);
  border-top-color:#fff; animation:spin .7s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg); } }

/* the sunburst mark, reused everywhere as the one signature element */
.sunmark{ display:block; }
.sunmark path{ transition:opacity .3s; }

/* =====================================================================
   AUTH PAGES — login / activate
===================================================================== */
.auth-page{
  min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px;
  background:
    radial-gradient(760px 500px at 14% 8%, rgba(248,210,13,.10), transparent 60%),
    radial-gradient(900px 700px at 85% 90%, rgba(47,89,174,.18), transparent 55%),
    linear-gradient(160deg, var(--navy-950) 0%, var(--navy-900) 60%, #0c0f26 100%);
}
.auth-card{
  width:100%; max-width:400px; background:var(--surface); border-radius:var(--radius-lg);
  box-shadow:var(--shadow-lg); padding:40px 36px; position:relative; overflow:hidden;
}
.auth-card::before{
  content:''; position:absolute; top:-90px; right:-90px; width:220px; height:220px; border-radius:50%;
  background:radial-gradient(circle, rgba(248,210,13,.16), transparent 70%);
}
.auth-mark{ width:46px; height:46px; margin-bottom:22px; position:relative; }
.auth-card h1{ font-size:21px; margin:0 0 4px; color:var(--navy-900); letter-spacing:-.01em; }
.auth-card p.sub{ font-size:13.5px; color:var(--ink-400); margin:0 0 28px; line-height:1.5; }
.auth-field{ margin-bottom:16px; }
.auth-error{
  background:var(--warn-bg); color:var(--warn-600); font-size:13px; font-weight:600; padding:11px 14px;
  border-radius:var(--radius-sm); margin-bottom:16px; display:none;
}
.auth-error.show{ display:block; }
.auth-note{
  background:var(--paper); color:var(--ink-600); font-size:12.5px; padding:12px 14px; border-radius:var(--radius-sm);
  margin-bottom:16px; line-height:1.55;
}
.auth-submit{ width:100%; padding:13px; font-size:14px; margin-top:6px; }
.auth-foot{ text-align:center; margin-top:22px; font-size:11.5px; color:var(--ink-400); letter-spacing:.02em; }
.auth-identity{ background:var(--paper); border-radius:var(--radius-sm); padding:14px 16px; margin-bottom:22px; }
.auth-identity .name{ font-weight:700; font-size:14.5px; color:var(--navy-900); }
.auth-identity .email{ font-size:12.5px; color:var(--ink-400); margin-top:2px; }

/* =====================================================================
   APP SHELL — sidebar + topbar + content
===================================================================== */
#app-root{ display:flex; min-height:100vh; }
.sidebar{
  width:248px; flex-shrink:0; background:var(--navy-900); color:#dfe1f5;
  display:flex; flex-direction:column; position:sticky; top:0; height:100vh;
}
.sidebar-brand{ display:flex; align-items:center; gap:11px; padding:24px 22px; }
.sidebar-brand .sunmark{ width:32px; height:32px; }
.sidebar-brand b{ font-size:15px; letter-spacing:.03em; color:#fff; display:block; }
.sidebar-brand span{ font-size:10px; color:#8489bb; letter-spacing:.08em; }
.sidebar-nav{ flex:1; padding:10px 12px; }
.nav-item{
  display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:var(--radius-sm);
  cursor:pointer; font-size:13.5px; color:#b9bce0; margin-bottom:2px; font-weight:600; transition:.15s cubic-bezier(.4,0,.2,1);
}
.nav-item svg{ width:17px; height:17px; opacity:.8; flex-shrink:0; }
.nav-item:hover{ background:#242a63; color:#fff; }
.nav-item.active{ background:linear-gradient(135deg, #ffe667, var(--gold-500)); color:#241a05; box-shadow:0 4px 14px rgba(248,210,13,.3); }
.nav-item.active svg{ opacity:1; }
.nav-divider{ height:1px; background:#2b3170; margin:10px 14px; }
.sidebar-foot{ padding:16px; }
.who-box{ background:#242a63; border-radius:var(--radius-sm); padding:12px 13px; margin-bottom:10px; }
.who-box .name{ font-size:12.5px; font-weight:700; color:#fff; }
.who-box .role{ font-size:10.5px; color:#8489bb; margin-top:2px; }
.logout-btn{
  width:100%; padding:9px; border-radius:var(--radius-sm); border:1.5px solid #363c85; background:transparent;
  color:#b9bce0; font-size:12.5px; font-weight:700; cursor:pointer;
}
.logout-btn:hover{ border-color:var(--gold-500); color:#fff; }

.main-col{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{
  background:var(--surface); border-bottom:1px solid var(--line); padding:18px 30px;
  display:flex; justify-content:space-between; align-items:center; gap:16px;
  position:sticky; top:0; z-index:10;
}
.topbar .crumb{ font-size:11px; color:var(--ink-400); text-transform:uppercase; letter-spacing:.06em; font-weight:700; margin-bottom:3px; }
.topbar h1{ font-size:19px; margin:0; letter-spacing:-.01em; }
.topbar .actions{ display:flex; gap:10px; align-items:center; }

.office-switcher{
  display:flex; align-items:center; gap:9px; background:var(--paper); border:1.5px solid var(--line-strong);
  border-radius:var(--radius-sm); padding:8px 12px 8px 14px;
}
.office-switcher label{ font-size:11px; font-weight:700; color:var(--ink-400); text-transform:uppercase; letter-spacing:.05em; }
.office-switcher select{ border:none; background:transparent; padding:0; font-weight:700; font-size:13px; color:var(--navy-800); width:auto; }
.office-switcher select:focus{ box-shadow:none; }

.content{ flex:1; padding:28px 30px 60px; max-width:1360px; width:100%; margin:0 auto; }
footer.app-note{ padding:14px 30px; font-size:11px; color:var(--ink-400); border-top:1px solid var(--line); }

.write-lock-banner{
  display:none; align-items:center; gap:10px; background:var(--pend-bg); color:var(--pend-600);
  padding:12px 16px; border-radius:var(--radius-sm); font-size:13px; font-weight:600; margin-bottom:18px;
}
.write-lock-banner.show{ display:flex; }

/* KPIs */
.kpi-row{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; margin-bottom:20px; }
.kpi-card{ padding:18px 20px; border-radius:var(--radius-md); transition:transform .18s cubic-bezier(.4,0,.2,1), box-shadow .18s; }
.kpi-card b{ display:block; font-size:27px; font-family:var(--font-display); color:var(--navy-900); }
.kpi-card span{ font-size:11.5px; color:var(--ink-400); font-weight:700; text-transform:uppercase; letter-spacing:.03em; }
.kpi-card.accent{ border-top:3px solid var(--gold-500); }
.kpi-card.clickable{ cursor:pointer; }
.kpi-card.clickable:hover{ transform:translateY(-3px); box-shadow:var(--shadow-md); border-color:var(--blue-500); }

/* warning cards — dashboard + réclamations, only shown when something
   actually needs attention */
.warnings-row{ display:flex; flex-direction:column; gap:8px; margin-bottom:20px; }
.warning-card{
  background:linear-gradient(90deg, var(--warn-bg), #fff4ee); color:var(--warn-600); font-weight:700; font-size:13px;
  padding:12px 16px; border-radius:var(--radius-sm); cursor:pointer; border-left:4px solid var(--warn-600);
  transition:.15s;
}
.warning-card:hover{ background:linear-gradient(90deg, #fbdccb, #fff4ee); transform:translateX(2px); }

/* topbar-integrated search + filters — consolidated here to keep the
   table area itself as tall as possible */
.topbar-search{ width:200px; padding:9px 12px; font-size:13px; }
.topbar-filter{ width:auto; min-width:130px; padding:9px 12px; font-size:13px; }

/* client name cell — wraps rather than overflows, capped to roughly the
   width of the audit line beneath it so a long name doesn't stretch the
   whole column; the audit line itself never wraps (it reads better as
   one continuous line) and stays a notch smaller */
.col-nom{ max-width:220px; }
.col-nom b{ display:block; white-space:normal; word-break:break-word; line-height:1.3; }
.row-meta{ display:block; font-size:10px; font-weight:500; color:var(--ink-400); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:220px; }

/* client hover card */
.hover-card{
  position:fixed; z-index:150; background:var(--surface); border-radius:var(--radius-md);
  box-shadow:var(--shadow-lg); border:1px solid var(--line); padding:16px 18px; width:280px;
  opacity:0; pointer-events:none; transform:translateY(4px); transition:opacity .12s, transform .12s;
}
.hover-card.show{ opacity:1; transform:translateY(0); }
.hover-card-name{ font-family:var(--font-display); font-weight:800; font-size:15px; color:var(--navy-900); margin-bottom:10px; }
.hover-card-grid{ display:grid; grid-template-columns:auto 1fr; gap:6px 10px; font-size:12px; }
.hover-card-grid span{ color:var(--ink-400); font-weight:600; }
.hover-card-grid b{ color:var(--ink-900); font-weight:600; text-align:right; }
.hover-card-notes{ margin-top:12px; padding-top:12px; border-top:1px solid var(--line); }
.hover-card-notes span{ font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-400); }
.hover-card-notes p{ margin:6px 0 0; font-size:12.5px; color:var(--ink-600); line-height:1.5; white-space:pre-wrap; }

.panel{ padding:22px 24px; border-radius:var(--radius-md); margin-bottom:20px; }
.panel h3{ margin:0 0 16px; font-size:14.5px; color:var(--navy-900); }

.bar-row{ display:flex; align-items:center; gap:12px; margin-bottom:12px; font-size:13px; }
.bar-label{ width:126px; flex-shrink:0; color:var(--ink-600); font-weight:600; }
.bar-track{ flex:1; height:9px; background:var(--paper); border-radius:6px; overflow:hidden; }
.bar-fill{ height:100%; border-radius:6px; transition:width .4s ease; }
.bar-count{ width:30px; text-align:right; font-weight:800; color:var(--navy-900); }

.recent-list{ list-style:none; margin:0; padding:0; }
.recent-list li{ display:flex; justify-content:space-between; align-items:center; padding:11px 0; border-bottom:1px solid var(--line); font-size:13px; }
.recent-list li:last-child{ border-bottom:none; }
.recent-list .rname{ font-weight:700; }
.recent-list .rmeta{ color:var(--ink-400); font-size:11.5px; }

/* toolbar / filters */
.toolbar{
  display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px;
  position:sticky; top:75px; z-index:9; background:var(--paper); padding:10px 0;
}
.toolbar .left{ display:flex; gap:8px; flex-wrap:wrap; }
.toolbar select,.toolbar input[type=text]{ padding:9px 12px; font-size:13px; width:auto; min-width:150px; }

/* tables — height is capped so the horizontal scrollbar sits at the
   bottom of the visible box (always on-screen) instead of at the very
   bottom of a possibly very long table (scrolled out of view). The
   header stays pinned while scrolling vertically inside that box. */
.table-wrap{
  overflow:auto; max-height:calc(100vh - 250px); border:1px solid var(--line); border-radius:var(--radius-md);
  background:var(--surface); box-shadow:var(--shadow-sm);
}
table{ width:100%; border-collapse:collapse; font-size:12.8px; }
thead th{
  background:#fafafd; color:var(--navy-800); text-align:left; padding:12px 14px; font-size:10.5px;
  text-transform:uppercase; letter-spacing:.05em; font-weight:800; border-bottom:1.5px solid var(--line); white-space:nowrap;
  position:sticky; top:0; z-index:2;
}
tbody td{ padding:12px 14px; border-bottom:1px solid var(--line); white-space:nowrap; }
tbody tr{ cursor:pointer; transition:background .12s; }
tbody tr:hover{ background:var(--paper); }
tbody tr:last-child td{ border-bottom:none; }
.row-del{ cursor:pointer; color:var(--ink-400); border:none; background:none; font-size:15px; padding:5px; border-radius:6px; }
.row-del:hover{ color:var(--warn-600); background:var(--warn-bg); }
.empty-state{ padding:70px 20px; text-align:center; color:var(--ink-400); }
.empty-state svg{ width:44px; height:44px; margin-bottom:14px; opacity:.35; }
.empty-state p{ font-size:13.5px; margin:0; }

/* modal */
.modal-overlay{ position:fixed; inset:0; background:rgba(16,20,47,.55); display:flex; align-items:flex-start; justify-content:flex-end; z-index:100; backdrop-filter:blur(2px); }
.modal-panel{ width:100%; max-width:480px; height:100vh; background:var(--surface); overflow-y:auto; box-shadow:-16px 0 50px rgba(16,20,47,.3); animation:slidein .18s ease-out; }
@keyframes slidein{ from{ transform:translateX(28px); opacity:.4; } to{ transform:translateX(0); opacity:1; } }
.modal-head{ padding:22px 26px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; position:sticky; top:0; background:var(--surface); z-index:2; }
.modal-head h3{ margin:0; font-size:16.5px; color:var(--navy-900); }
.modal-close{ border:none; background:none; font-size:20px; cursor:pointer; color:var(--ink-400); border-radius:6px; padding:4px 8px; }
.modal-close:hover{ background:var(--paper); }
.modal-body{ padding:24px 26px; }
.field-row2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.field-group{ margin-bottom:16px; }
.field-group.full{ grid-column:1/-1; }
.modal-foot{ padding:18px 26px; border-top:1px solid var(--line); display:flex; justify-content:space-between; gap:10px; position:sticky; bottom:0; background:var(--surface); }
.modal-error{ background:var(--warn-bg); color:var(--warn-600); font-size:12.5px; font-weight:600; padding:10px 13px; border-radius:var(--radius-sm); margin-bottom:16px; display:none; }
.modal-error.show{ display:block; }

/* financier payments */
.payments-list{ border:1px solid var(--line); border-radius:var(--radius-sm); margin-top:8px; }
.payment-row{ display:flex; gap:8px; align-items:center; padding:9px 11px; border-bottom:1px solid var(--line); font-size:12.5px; }
.payment-row:last-child{ border-bottom:none; }
.payment-row input{ padding:7px 9px; font-size:12.5px; }
.reste-box{ margin-top:15px; padding:13px 15px; border-radius:var(--radius-sm); background:var(--paper); display:flex; justify-content:space-between; font-size:13.5px; font-weight:800; color:var(--navy-900); }

/* export view */
.export-grid{ display:flex; gap:12px; flex-wrap:wrap; margin-top:18px; }
.export-scope-note{ font-size:13px; color:var(--ink-600); background:var(--paper); padding:10px 14px; border-radius:var(--radius-sm); display:inline-block; margin-bottom:4px; }

/* employes view */
.role-badge{ display:inline-flex; align-items:center; gap:6px; }

@media (max-width: 880px){
  .sidebar{ width:76px; }
  .sidebar-brand span, .sidebar-brand b, .nav-item span, .who-box{ display:none; }
  .nav-item{ justify-content:center; }
  .sidebar-brand{ justify-content:center; padding:20px 0; }
  .content{ padding:20px; }
  .field-row2{ grid-template-columns:1fr; }
}
