/* =====================================================================
   AJP CRM — interface system
   "Le registre" : a broker's ledger. Ruled lines rather than stacked
   boxes, figures set in tabular mono, navy for structure, gold reserved
   for trust and value alone.

   One file, no build step: the host has no Node toolchain and deploys are
   a zip upload, so a compiled pipeline would be a step nobody can run in
   an emergency.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Tokens
   Density is "balanced": lists and tables run tight and scannable, the
   dossier and forms run roomy, because one is scanned and the other read.
   --------------------------------------------------------------------- */
:root {
  /* Ink & ground */
  --ink:         #101a2b;
  --ink-2:       #2f3d55;
  --muted:       #5b6676;   /* 5.3:1 on --paper */
  --line:        #dfe4ec;
  --line-soft:   #eaeef4;
  --paper:       #f7f8fa;
  --surface:     #ffffff;
  --surface-2:   #fafbfd;

  /* Brand */
  --navy:        #0f3d6e;
  --navy-deep:   #0a2a4d;
  --navy-lift:   #164e88;   /* hover state for navy fills */
  --navy-2:      #1b5fa8;
  --navy-soft:   #e9f0f8;

  /* Orange is the second lead colour, not a garnish: it carries ACTION and
     ATTENTION while navy carries structure. Filled orange always takes
     deep navy text (#0a2a4d on #e08a1e is 5.6:1) — white on orange is only
     3.0:1 and fails. --gold-ink is the small-text-on-white variant. */
  --orange:      #e08a1e;
  --orange-lift: #f09a2c;
  --orange-deep: #b8690c;
  --gold:        #c8862a;
  --gold-ink:    #8a5b16;
  --gold-light:  #e8b45f;
  --gold-soft:   #fdf1dd;
  --gold-line:   #f0d3a0;

  /* Semantic */
  --ok:          #17703f;
  --ok-soft:     #e7f4ec;
  --warn:        #96590a;
  --warn-soft:   #fdf2e0;
  --danger:      #a81d13;
  --danger-soft: #fdecea;
  --info:        #17558f;
  --info-soft:   #e9f1f9;

  /* Form */
  --r-sm: 7px;
  --r:    10px;
  --r-lg: 14px;

  /* Floating things only. Flat surfaces earn a rule, not a shadow. */
  --lift:   0 4px 12px -2px rgba(16, 26, 43, .10), 0 2px 4px -2px rgba(16, 26, 43, .06);
  --lift-lg:0 18px 40px -12px rgba(16, 26, 43, .28), 0 4px 10px -4px rgba(16, 26, 43, .12);

  --sans:  'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --mono:  'DM Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  /* One authored motion curve: exponential ease-out. */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --fast: 120ms;
  --slow: 380ms;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.011em;
  margin: 0;
  text-wrap: balance;
}

/* Figures are measurement: mono with tabular alignment so columns of
   money and counts line up digit for digit. */
.mono, .figure__value, .rate-row__value, .metric__count,
td.num, .money { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.muted { color: var(--muted); font-size: .875rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon { width: 18px; height: 18px; flex: none; }

kbd {
  font-family: var(--mono); font-size: .7rem; padding: 1px 5px;
  border: 1px solid currentColor; border-radius: 4px;
  opacity: .5; letter-spacing: .02em;
}

:focus-visible {
  outline: 2px solid var(--navy-2);
  outline-offset: 2px;
  border-radius: 3px;
}

/* =====================================================================
   Masthead — the brand anchor. Navy carries the identity so the working
   canvas beneath can stay quiet paper.
   ===================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
}
.topbar__inner {
  display: flex; align-items: stretch; gap: 1.5rem;
  max-width: 1560px; margin: 0 auto; padding: 0 1.5rem;
  min-height: 56px;
}

.brand {
  display: flex; flex-direction: column; justify-content: center;
  line-height: 1.15; text-decoration: none; padding-right: .5rem;
}
.brand:hover { text-decoration: none; }
.brand__name {
  font-family: var(--serif); font-weight: 700; font-size: 1rem;
  color: #fff; letter-spacing: -.01em; white-space: nowrap;
}
.brand__name span { color: var(--gold-light); }
.brand__tag {
  font-size: .58rem; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(255,255,255,.5); font-weight: 500;
}

.nav { display: flex; align-items: stretch; gap: .1rem; flex: 1; }
.nav > a, .nav-more > summary {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: 0 .8rem; position: relative;
  color: rgba(255,255,255,.72);
  font-size: .8125rem; font-weight: 500; text-decoration: none;
  white-space: nowrap; cursor: pointer; list-style: none;
  transition: color var(--fast) ease;
}
.nav > a:hover, .nav-more > summary:hover { color: #fff; text-decoration: none; }
.nav > a .icon, .nav-more > summary .icon { opacity: .8; }

/* The gold rule under the active section is the signature detail. */
.nav > a::after {
  content: ''; position: absolute; left: .55rem; right: .55rem; bottom: 0;
  height: 2px; background: var(--gold-light);
  transform: scaleX(0); transform-origin: center;
  transition: transform var(--fast) var(--ease);
}
.nav > a.is-active { color: #fff; font-weight: 600; }
.nav > a.is-active::after { transform: scaleX(1); }

.nav-pill {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--gold); color: var(--navy-deep);
  font-family: var(--mono); font-size: .66rem; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
}

.nav-more, .user-menu { position: relative; display: flex; }
.nav-more > summary::-webkit-details-marker,
.user-menu > summary::-webkit-details-marker { display: none; }

.nav-menu {
  position: absolute; top: calc(100% - 6px); left: .4rem; z-index: 50;
  min-width: 232px; padding: .3rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--lift-lg);
  display: flex; flex-direction: column;
  animation: menu-in 160ms var(--ease);
}
.nav-menu--right { left: auto; right: 0; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }

.nav-menu a, .nav-menu__button {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .6rem; border-radius: var(--r-sm);
  font-family: inherit; font-size: .8375rem; color: var(--ink-2);
  text-decoration: none; background: none; border: 0;
  width: 100%; text-align: left; cursor: pointer;
}
.nav-menu a:hover, .nav-menu__button:hover { background: var(--navy-soft); color: var(--navy); text-decoration: none; }
.nav-menu__meta {
  padding: .5rem .6rem .55rem; font-size: .78rem; color: var(--muted);
  border-bottom: 1px solid var(--line-soft); margin-bottom: .2rem; line-height: 1.4;
}

.topbar__right { display: flex; align-items: center; gap: .35rem; margin-left: auto; }

.global-search-trigger {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .38rem .6rem .38rem .7rem;
  border: 1px solid rgba(255,255,255,.16); border-radius: 999px;
  background: rgba(255,255,255,.07); color: rgba(255,255,255,.7);
  font: inherit; font-size: .78rem; cursor: pointer;
  transition: background var(--fast) ease, border-color var(--fast) ease;
}
.global-search-trigger:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #fff; }

.notif-bell {
  position: relative; display: inline-flex; padding: .45rem;
  border-radius: 50%; color: rgba(255,255,255,.75);
}
.notif-bell:hover { background: rgba(255,255,255,.1); color: #fff; }
.notif-dot {
  position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--gold); color: var(--navy-deep);
  font-family: var(--mono); font-size: .6rem; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--navy-deep);
}

.user-menu > summary {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  padding: 0 .5rem; color: rgba(255,255,255,.85); font-size: .8125rem; list-style: none;
}
.user-menu > summary:hover { color: #fff; }
.user-menu__name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: rgba(255,255,255,.16); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
}
.avatar--sm { width: 26px; height: 26px; font-size: .66rem; background: var(--navy-soft); color: var(--navy); }

/* =====================================================================
   Page shell
   ===================================================================== */
.page { max-width: 1560px; margin: 0 auto; padding: 2rem 1.5rem 5rem; }

/* Space above a heading exceeds the space below it, so a title binds to
   its own content rather than floating between two blocks. */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  padding-bottom: 1.1rem; margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: clamp(1.45rem, 2.1vw, 1.8rem); }
.page-title--sm { font-size: 1.15rem; }
.page-subtitle {
  margin: .5rem 0 0; color: var(--muted); font-size: .875rem;
  max-width: 68ch; line-height: 1.6;
}
.header-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* =====================================================================
   Figures — a ruled summary band, not a row of metric cards.
   Label first, value in tabular mono, separated by hairlines.
   ===================================================================== */
.figures {
  display: grid; gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 1.75rem; overflow: hidden;
}
.figure {
  padding: .95rem 1.15rem;
  border-left: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: .2rem;
  color: inherit; text-decoration: none;
  transition: background var(--fast) ease;
}
.figure:first-child { border-left: 0; }
a.figure:hover { background: var(--surface-2); text-decoration: none; }
.figure__label {
  font-size: .7rem; color: var(--muted); font-weight: 500;
  letter-spacing: .01em; order: 1;
}
.figure__value {
  font-size: 1.45rem; font-weight: 500; line-height: 1.1;
  color: var(--ink); letter-spacing: -.02em; order: 2;
}
/* Gold marks the single figure that represents money earned. */
.figure--value .figure__value { color: var(--gold-ink); }
.figure--alert .figure__value { color: var(--danger); }

/* =====================================================================
   Panels — contained working surfaces. Bordered, never shadowed:
   shadow is reserved for things that genuinely float.
   ===================================================================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.panel__header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .95rem 1.25rem;
  border-bottom: 1px solid var(--line-soft);
}
.panel__title { font-size: 1.0625rem; font-weight: 600; }
.panel__body { padding: 1.25rem; }
.panel--narrow { max-width: 760px; }
.panel--danger { border-color: #f0cdc9; }
.panel--danger .panel__title { color: var(--danger); }

/* =====================================================================
   Buttons — gold is never a button. Navy carries action.
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 36px; padding: 0 .85rem; border-radius: var(--r-sm);
  font: inherit; font-size: .8375rem; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  white-space: nowrap;
  transition: background var(--fast) ease, border-color var(--fast) ease, color var(--fast) ease;
}
.btn:hover { text-decoration: none; }
/* The primary action is orange with navy text: it is the loudest thing on
   a quiet page, which is exactly what a primary action should be. */
.btn--primary {
  background: var(--orange); color: var(--navy-deep); font-weight: 600;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.10);
}
.btn--primary:hover { background: var(--orange-lift); }
.btn--navy { background: var(--navy); color: #fff; font-weight: 600; }
.btn--navy:hover { background: var(--navy-lift); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--orange); color: var(--orange-deep); background: var(--gold-soft); }
.btn--flat { background: transparent; color: var(--muted); }
.btn--flat:hover { background: var(--line-soft); color: var(--ink); }
.btn--danger { background: var(--danger); color: #fff; font-weight: 600; }
.btn--danger:hover { filter: brightness(1.1); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-link {
  display: inline-flex; padding: .35rem; border-radius: var(--r-sm);
  color: var(--muted); transition: background var(--fast) ease, color var(--fast) ease;
}
.icon-link:hover { background: var(--navy-soft); color: var(--navy); }

/* =====================================================================
   Forms
   ===================================================================== */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .95rem; }
.field > label, .stacked-form label {
  font-size: .78rem; font-weight: 600; color: var(--ink-2); letter-spacing: .002em;
}
.field-control {
  width: 100%; min-height: 36px; padding: .45rem .65rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: .8625rem; color: var(--ink); background: var(--surface);
  transition: border-color var(--fast) ease, box-shadow var(--fast) ease;
}
.field-control::placeholder { color: #8a94a3; }
.field-control:focus {
  outline: none; border-color: var(--navy-2);
  box-shadow: 0 0 0 3px rgba(27, 95, 168, .14);
}
.field-control[disabled] { background: var(--line-soft); color: var(--muted); cursor: not-allowed; }
.field-control--grow { flex: 1; min-width: 8rem; }
textarea.field-control { resize: vertical; min-height: 82px; line-height: 1.55; }
select.field-control { cursor: pointer; }

.field-box {
  display: flex; align-items: center; gap: .55rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 0 .7rem; background: var(--surface); color: var(--muted);
  transition: border-color var(--fast) ease, box-shadow var(--fast) ease;
}
.field-box:focus-within { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(27,95,168,.14); }
.field-box input {
  flex: 1; border: 0; padding: .6rem 0; font: inherit; font-size: .9rem;
  background: none; outline: none; color: var(--ink);
}

.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.15rem; }
.field--full { grid-column: 1 / -1; }
.field-stack > .field:last-child { margin-bottom: 0; }

.save-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding-top: .75rem;
}
.stacked-form { display: flex; flex-direction: column; gap: .6rem; }
.stacked-form label { display: flex; flex-direction: column; gap: .25rem; }

.piece-label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8625rem; font-weight: 400; cursor: pointer; color: var(--ink-2);
}
.piece-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--navy); flex: none; }

.filters {
  display: flex; align-items: flex-end; gap: .7rem; flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.filters .field { margin-bottom: 0; min-width: 158px; }
.filter-more > summary { list-style: none; cursor: pointer; }
.filter-more > summary::-webkit-details-marker { display: none; }

.side-note { margin: .6rem 0 0; }

/* =====================================================================
   Tables — the ledger. Tight rows, hairline rules, tabular figures.
   ===================================================================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .8625rem; }
thead th {
  /* NOT sticky: .table-wrap sets overflow-x, which makes it a scroll
     container on both axes, so `top: 56px` offsets the header inside that
     container and drops it on top of the first row. The page itself is
     what scrolls, so a plain header is both correct and what users see. */
  text-align: left; padding: .5rem 1.15rem; white-space: nowrap;
  font-size: .67rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
tbody td {
  padding: .55rem 1.15rem; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle; height: 44px;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--fast) ease; }
tbody tr:hover { background: var(--surface-2); }
.row-link { cursor: pointer; }
.lead-name { font-weight: 600; color: var(--ink); }
.text-truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-actions, .row-actions { display: flex; align-items: center; gap: .15rem; }

.user-cell { display: flex; align-items: center; gap: .6rem; }
.user-cell > span { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.user-cell small { font-size: .76rem; }

.row-menu { position: relative; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu__panel {
  position: absolute; right: 0; top: calc(100% + 5px); z-index: 30;
  width: 288px; padding: .9rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--lift-lg);
  display: flex; flex-direction: column; gap: .7rem;
  animation: menu-in 160ms var(--ease);
}

/* Card list replaces the table below 900px. */
.mobile-cards { display: none; padding: .7rem; gap: .6rem; flex-direction: column; }
.lead-card {
  border: 1px solid var(--line); border-radius: var(--r);
  padding: .85rem; background: var(--surface);
  display: flex; flex-direction: column; gap: .5rem;
}
.lead-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.lead-card__actions { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }

/* =====================================================================
   Badges — semantic tint plus a hairline of the same hue, so they read
   as objects on white rather than floating colour.
   ===================================================================== */
.badge, .status {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .12rem .5rem; border-radius: 5px;
  font-size: .72rem; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; letter-spacing: .005em;
}
.badge--ok,     .status--gagne        { background: var(--ok-soft);     color: var(--ok);     border-color: rgba(23,112,63,.18); }
.badge--warn,   .status--contacte     { background: var(--warn-soft);   color: var(--warn);   border-color: rgba(150,89,10,.18); }
.badge--danger, .status--perdu        { background: var(--danger-soft); color: var(--danger); border-color: rgba(168,29,19,.18); }
.badge--info,   .status--devis_envoye { background: var(--info-soft);   color: var(--info);   border-color: rgba(23,85,143,.18); }
.badge--muted,  .status--nouveau      { background: var(--line-soft);   color: var(--ink-2);  border-color: var(--line); }

.priority-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; }
.priority-dot--high { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* =====================================================================
   Lists & meters
   ===================================================================== */
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: 0; }
.list-row__actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rate-row__label { font-size: .8625rem; color: var(--ink); min-width: 0; }
.rate-row__value { font-size: .8rem; color: var(--muted); }
.rate-list { display: flex; flex-direction: column; }
.rate-row { margin-bottom: .9rem; }
.rate-row:last-child { margin-bottom: 0; }
.rate-row__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .3rem; }

progress {
  width: 100%; height: 5px; border: 0; border-radius: 999px;
  background: var(--line-soft); appearance: none; display: block;
  margin-bottom: 1rem;
}
.rate-row progress { margin-bottom: 0; }
progress::-webkit-progress-bar { background: var(--line-soft); border-radius: 999px; }
/* No transition on the value: it is rendered server-side and never changes
   without a reload, so an animation here would only ever cost layout work. */
progress::-webkit-progress-value { background: var(--navy-2); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--navy-2); border-radius: 999px; }

/* =====================================================================
   Alerts
   ===================================================================== */
.alert {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding: .75rem .95rem; margin-bottom: 1rem;
  border-radius: var(--r-sm); font-size: .8625rem; line-height: 1.5;
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid rgba(168,29,19,.2);
}
.alert--success { background: var(--ok-soft);   color: var(--ok);   border-color: rgba(23,112,63,.2); }
.alert--info    { background: var(--info-soft); color: var(--info); border-color: rgba(23,85,143,.2); }
.alert--warn    { background: var(--warn-soft); color: var(--warn); border-color: rgba(150,89,10,.2); }
.alert p { margin: .3rem 0 .5rem; }
.alert .icon { flex: none; vertical-align: -3px; }
.invite-link .field-control { margin-top: .5rem; font-family: var(--mono); font-size: .76rem; }

/* =====================================================================
   Empty & terminal states
   ===================================================================== */
.state-card {
  text-align: center; padding: 3.5rem 1.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.state-icon {
  width: 46px; height: 46px; margin: 0 auto 1rem; border-radius: 50%;
  background: var(--navy-soft); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.state-icon .icon { width: 21px; height: 21px; }
.empty-state, .empty-copy {
  color: var(--muted); font-size: .8625rem; text-align: center;
  padding: 1.5rem 0; margin: 0;
}
.done-state { display: flex; align-items: center; gap: .9rem; padding: 1.4rem 1.25rem; }
.done-state > span {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--ok-soft); color: var(--ok);
  display: flex; align-items: center; justify-content: center;
}
.done-state p { margin: .1rem 0 0; color: var(--muted); font-size: .8375rem; }

/* =====================================================================
   Filter chips (status counts) — navigation, not hero metrics.
   ===================================================================== */
.metric-strip {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.5rem;
}
.metric {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4rem .75rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); text-decoration: none; font-size: .8125rem;
  transition: border-color var(--fast) ease, background var(--fast) ease;
}
.metric:hover { border-color: var(--navy-2); text-decoration: none; }
.metric.is-active { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.metric.is-active .metric__label,
.metric.is-active .metric__sub { color: #fff; }
.metric > span { display: inline-flex; align-items: center; gap: .45rem; }
.metric__label { color: inherit; }
.metric__count { font-size: .8125rem; font-weight: 500; opacity: .75; }
/* The secondary figure needs its own separator, or "Nouveau 11 0 €" reads
   as one run-on number. */
.metric__sub {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: .75rem; color: var(--muted);
  padding-left: .5rem; margin-left: .1rem;
  border-left: 1px solid var(--line);
}
.metric.is-active .metric__sub { border-left-color: rgba(255,255,255,.28); }

/* =====================================================================
   Home
   ===================================================================== */
.home-hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  padding-bottom: 1.1rem; margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}
.home-hero h1 { font-size: clamp(1.5rem, 2.3vw, 1.95rem); margin-bottom: .35rem; }
.home-hero > div > p { margin: 0; color: var(--muted); font-size: .9rem; max-width: 62ch; }
.home-hero strong { color: var(--ink); font-weight: 600; }

.quick-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.quick-action {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .85rem; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); text-decoration: none; cursor: pointer;
  font: inherit; text-align: left;
  transition: border-color var(--fast) ease, background var(--fast) ease;
}
.quick-action:hover { border-color: var(--navy-2); text-decoration: none; }
.quick-action > span { display: flex; flex-direction: column; line-height: 1.3; }
.quick-action small { color: var(--muted); font-size: .72rem; }
.quick-action--primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.quick-action--primary:hover { background: var(--navy-lift); border-color: var(--navy-lift); }
.quick-action--primary small { color: rgba(255,255,255,.7); }

.home-layout { display: grid; grid-template-columns: minmax(0,1.85fr) minmax(0,1fr); gap: 1.5rem; align-items: start; }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.85fr) minmax(0,1fr); gap: 1.5rem; align-items: start; }
.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.5rem; }
.home-side, .stack, .home-main { display: flex; flex-direction: column; min-width: 0; }

.action-list { display: flex; flex-direction: column; }
.action-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem 1.25rem; border-bottom: 1px solid var(--line-soft);
  transition: background var(--fast) ease;
}
.action-row:last-child { border-bottom: 0; }
.action-row:hover { background: var(--surface-2); }
.action-row__copy { flex: 1; display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.action-row__copy > a, .action-row__copy > strong { font-weight: 600; color: var(--ink); }
.action-row__copy small { color: var(--muted); font-size: .765rem; }
.action-row__buttons { display: flex; align-items: center; gap: .2rem; }

/* =====================================================================
   Timeline
   ===================================================================== */
.timeline { display: flex; flex-direction: column; }
.timeline__day {
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 1.1rem 0 .45rem;
}
.timeline__day:first-child { padding-top: 0; }
.timeline__item { display: flex; gap: .8rem; padding: .5rem 0; position: relative; }
.timeline__item::before {
  content: ''; position: absolute; left: 14px; top: 32px; bottom: -6px;
  width: 1px; background: var(--line);
}
.timeline__item:last-child::before { display: none; }
.timeline__icon {
  width: 29px; height: 29px; border-radius: 50%; flex: none; z-index: 1;
  background: var(--navy-soft); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.timeline__icon .icon { width: 14px; height: 14px; }
.timeline__body { flex: 1; min-width: 0; padding-top: .1rem; }
.timeline__title { font-size: .8625rem; font-weight: 600; }
.timeline__detail { font-size: .8125rem; color: var(--ink-2); word-break: break-word; }
.timeline__meta { font-size: .73rem; color: var(--muted); margin-top: .1rem; }

/* =====================================================================
   Post-call outcome picker — the product's signature interaction and the
   one place motion is authored. Choosing an outcome reveals only the
   fields that outcome needs.
   ===================================================================== */
.outcome-grid {
  display: grid; gap: .45rem; margin-bottom: 1.15rem;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}
.outcome-option { position: relative; display: block; cursor: pointer; }
.outcome-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.outcome-option > span {
  display: block; padding: .55rem .7rem; text-align: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); font-size: .8375rem; font-weight: 500;
  color: var(--ink-2);
  transition: border-color var(--fast) ease, background var(--fast) ease,
              color var(--fast) ease, transform var(--fast) var(--ease);
}
.outcome-option:hover > span { border-color: var(--navy-2); color: var(--navy); }
.outcome-option input:checked + span {
  background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600;
}
.outcome-option input:focus-visible + span { outline: 2px solid var(--navy-2); outline-offset: 2px; }
.outcome-option:active > span { transform: scale(.985); }

/* The reveal: height, blur and lift resolve together on one curve.
   `visibility` is transitioned with a delay equal to the animation, so the
   block animates out and only then leaves the accessibility tree — the
   [hidden] attribute alone would be overridden by the display change here
   and would keep collapsed fields readable by a screen reader. */
[data-when-outcome] {
  display: grid; grid-template-rows: 1fr;
  opacity: 1; visibility: visible;
  transition: grid-template-rows var(--slow) var(--ease),
              opacity var(--slow) var(--ease),
              filter var(--slow) var(--ease),
              transform var(--slow) var(--ease),
              margin var(--slow) var(--ease),
              visibility 0s linear 0s;
}
[data-when-outcome] > * { overflow: hidden; min-height: 0; }
[data-when-outcome][hidden] {
  display: grid;
  /* grid-template-rows sizes only the FIRST row. These blocks hold a label
     and a control, so the second child lands in an implicit row — without
     grid-auto-rows it keeps its height and the "collapsed" field still
     occupies ~45px. row-gap must go too, or the .field gap survives. */
  grid-template-rows: 0fr; grid-auto-rows: 0fr; row-gap: 0;
  opacity: 0; filter: blur(3px); transform: translateY(-3px);
  margin-bottom: 0; pointer-events: none;
  visibility: hidden;
  transition-delay: 0s, 0s, 0s, 0s, 0s, var(--slow);
}

.doc-picker {
  display: flex; flex-direction: column; gap: .35rem;
  padding: .7rem .85rem; background: var(--surface-2);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
}

/* =====================================================================
   Import wizard
   ===================================================================== */
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: .8rem; }
.preview-table { font-size: .78rem; }
.preview-table td { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; height: auto; }

/* Ruled cells, not cards inside a card. */
.import-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; margin-bottom: 1.25rem;
}
.import-summary > div {
  padding: .8rem .9rem; text-align: left;
  border-left: 1px solid var(--line-soft);
  display: flex; flex-direction: column-reverse; gap: .15rem;
}
.import-summary > div:first-child { border-left: 0; }
.import-summary strong {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 1.2rem; font-weight: 500; line-height: 1.1;
}
.import-summary small { color: var(--muted); font-size: .7rem; }

/* =====================================================================
   Login & account activation
   ===================================================================== */
.login-view { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.login-story {
  background: linear-gradient(157deg, var(--navy-deep) 0%, var(--navy) 58%, #134a86 100%);
  color: #fff; padding: 2.75rem 3.25rem;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
/* A faint ruled ground: the ledger, quietly. */
.login-story::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 100% 2.25rem;
  mask-image: radial-gradient(120% 90% at 80% 15%, #000 25%, transparent 78%);
}
.login-story > * { position: relative; z-index: 1; }
.login-story .brand__name { color: #fff; font-size: 1.05rem; }
.login-story .brand__name span { color: var(--gold-light); }

.brandmark { display: flex; flex-direction: column; gap: .15rem; }
.brandmark__meta { font-size: .7rem; color: rgba(255,255,255,.55); letter-spacing: .05em; }
.brandmark--dark .brand__name { color: var(--ink); }
.brandmark--dark .brandmark__meta { color: var(--muted); }

.login-story__content { max-width: 31rem; }
.login-story__content h1 {
  font-size: clamp(2rem, 3.4vw, 2.6rem); color: #fff; margin-bottom: .8rem;
  letter-spacing: -.02em; line-height: 1.12;
}
.login-story__content h1 span { color: var(--gold-light); }
.login-story__content > p { color: rgba(255,255,255,.72); font-size: .95rem; max-width: 46ch; line-height: 1.6; }

.trust-chip {
  display: inline-flex; align-items: center; gap: .45rem; margin-bottom: 1.6rem;
  padding: .3rem .75rem; border-radius: 999px;
  background: rgba(232,180,95,.12); border: 1px solid rgba(232,180,95,.32);
  font-size: .74rem; color: var(--gold-light); font-weight: 500; letter-spacing: .01em;
}
/* A three-column grid rather than a flex row: the parent caps at 31rem for
   readable measure, and three flex items with long French labels overflow
   that and drop the third onto its own line. */
.proof-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem; margin-top: 2.5rem;
  padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.14);
}
.proof-item { display: flex; flex-direction: column; gap: .1rem; }
.proof-item strong {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 1.4rem; font-weight: 500; color: var(--gold-light);
}
.proof-item span { font-size: .73rem; color: rgba(255,255,255,.6); }

.login-form-shell { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--surface); }
.auth-narrow { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2.5rem 1.5rem; background: var(--surface); }
.login-panel { width: 100%; max-width: 396px; display: flex; flex-direction: column; }
.login-panel h2 { font-size: 1.35rem; margin: 1.9rem 0 .4rem; }
.login-panel > p { margin: 0 0 1.6rem; color: var(--muted); font-size: .875rem; line-height: 1.55; }
.login-alt { text-align: center; font-size: .83rem; margin: 1.1rem 0 0; }
.secure-note {
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  margin-top: 1.6rem; padding-top: 1.1rem; border-top: 1px solid var(--line-soft);
  font-size: .74rem; color: var(--muted);
}
.secure-note .icon { width: 14px; height: 14px; }

/* =====================================================================
   Command palette
   ===================================================================== */
.search-palette { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 9vh 1rem 1rem; }
.search-palette[hidden] { display: none; }
.search-palette__backdrop {
  position: absolute; inset: 0; border: 0; cursor: default;
  background: rgba(10, 26, 46, .38); backdrop-filter: blur(2px);
  animation: fade-in 160ms var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }
.search-dialog {
  position: relative; width: 100%; max-width: 620px;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--lift-lg);
  overflow: hidden; display: flex; flex-direction: column;
  animation: dialog-in 220ms var(--ease);
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(-8px) scale(.99); } }
.search-dialog__input { display: flex; align-items: center; gap: .6rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-dialog__input input { flex: 1; border: 0; outline: none; font: inherit; font-size: .98rem; color: var(--ink); background: none; }
.search-dialog__body { max-height: 52vh; overflow-y: auto; padding: .45rem; }
.search-hint { color: var(--muted); font-size: .83rem; padding: 1.25rem; text-align: center; margin: 0; }
.search-result {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  padding: .55rem .7rem; border-radius: var(--r-sm); color: var(--ink); text-decoration: none;
}
.search-result:hover, .search-result.is-active { background: var(--navy-soft); text-decoration: none; }
.search-result__type {
  font-size: .63rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700;
  color: var(--navy); background: var(--navy-soft); padding: .16rem .42rem;
  border-radius: 4px; flex: none; min-width: 62px; text-align: center;
}
.search-result.is-active .search-result__type { background: var(--surface); }
.search-result__body { display: flex; flex-direction: column; min-width: 0; }
.search-result__title { font-size: .875rem; font-weight: 600; }
.search-result__meta { font-size: .755rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dialog__footer {
  display: flex; gap: 1.25rem; padding: .55rem 1.1rem;
  border-top: 1px solid var(--line); background: var(--surface-2);
  font-size: .72rem; color: var(--muted);
}

/* =====================================================================
   Toast
   ===================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 1.75rem; transform: translate(-50%, 150%);
  z-index: 120; padding: .65rem 1.1rem; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: .8375rem; font-weight: 500;
  box-shadow: var(--lift-lg); pointer-events: none;
  max-width: min(92vw, 32rem); text-align: center;
  transition: transform var(--slow) var(--ease), opacity var(--fast) ease;
  opacity: 0;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast.is-error { background: var(--danger); }

/* =====================================================================
   Pagination
   ===================================================================== */
.pagination { display: flex; gap: .25rem; flex-wrap: wrap; padding: .9rem 1.25rem; border-top: 1px solid var(--line-soft); }
.pagination a {
  min-width: 32px; height: 32px; padding: 0 .5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  font-family: var(--mono); font-size: .78rem; color: var(--ink-2); text-decoration: none;
  transition: border-color var(--fast) ease, background var(--fast) ease;
}
.pagination a:hover { border-color: var(--navy-2); text-decoration: none; }
.pagination a.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1180px) {
  .home-layout, .detail-grid { grid-template-columns: 1fr; }
  .login-view { grid-template-columns: 1fr; }
  .login-story { display: none; }
}
@media (max-width: 900px) {
  .topbar__inner { flex-wrap: wrap; padding: 0 1rem; min-height: 52px; }
  .brand { padding: .5rem 0; }
  /* flex-basis must be reset to 100%: the base rule's `flex: 1` sets a
     basis of 0, which beats `width` and keeps the nav squeezed onto the
     first line instead of wrapping to its own row. */
  .nav {
    order: 3; flex: 0 0 100%; width: 100%;
    overflow-x: auto; gap: 0;
    border-top: 1px solid rgba(255,255,255,.1);
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav > a, .nav-more > summary { padding: .65rem .7rem; }
  .global-search-trigger span, .user-menu__name { display: none; }
  .topbar__right { padding: .4rem 0; }
  .page { padding: 1.25rem 1rem 3.5rem; }
  .desktop-table { display: none; }
  .mobile-cards { display: flex; }
  .info-grid, .analytics-grid { grid-template-columns: 1fr; }
  .figures { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
  .figure { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 560px) {
  .page-header, .home-hero { flex-direction: column; align-items: stretch; }
  .row-menu__panel { width: min(288px, calc(100vw - 2.5rem)); }
  .outcome-grid { grid-template-columns: 1fr 1fr; }
  .figures { grid-template-columns: 1fr 1fr; }
  .proof-row { gap: 1.5rem; }

  /* Quick actions become a grid rather than a flex row: `flex: 1` cannot
     shrink an item below its min-content, so three of them side by side
     push the page wider than the screen. */
  .quick-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-action--primary { grid-column: 1 / -1; }
  .header-actions .btn { flex: 1; justify-content: center; }
  .metric__sub { padding-left: .4rem; }
}

/* Nothing may push the document wider than the screen. Flex and grid
   children default to min-width:auto, which lets a long unbroken string
   force a horizontal scrollbar on the whole page. */
body { overflow-x: hidden; }
.action-row__copy, .rate-row__label, .user-cell > span,
.timeline__body, .search-result__body, .figure, .quick-action > span {
  min-width: 0;
}
.action-row__copy > a, .lead-name, .timeline__detail, .rate-row__label {
  overflow-wrap: anywhere;
}

/* Respect the system setting: motion becomes instant, never absent. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  [data-when-outcome] { filter: none; transform: none; }
}

@media print {
  .topbar, .header-actions, .toast, .search-palette, .quick-actions { display: none !important; }
  .panel, .figures { border-color: #ccc; }
  .page { padding: 0; }
}

/* =====================================================================
   ORANGE PASS
   Orange leads action and attention throughout, so the interface reads as
   AJP rather than as a generic navy dashboard. Filled orange always takes
   deep-navy text: white on orange is 3.0:1 and fails.
   ===================================================================== */

/* Every section title carries a short orange rule — the ruled margin of a
   ledger, and the cheapest way to make the brand present on every screen. */
.panel__title::before {
  content: ''; display: inline-block; vertical-align: middle;
  width: 14px; height: 3px; border-radius: 2px; margin-right: .55rem;
  background: var(--orange);
}

/* Figures band: one orange edge across the whole band, not a stripe per
   cell. A band edge reads as a rule; a coloured bar on each cell is the
   side-tab tell. Emphasis inside the band is carried by the figure colour. */
.figures { border-top: 2px solid var(--orange); }
.figure { position: relative; }
.figure--accent .figure__value,
.figure:first-child .figure__value { color: var(--orange-deep); }
.figure--value .figure__value { color: var(--gold-ink); }
.figure--alert .figure__value { color: var(--danger); }

/* Active states across filters and pagination. */
.metric:hover { border-color: var(--orange); background: var(--gold-soft); }
.metric.is-active { background: var(--orange); border-color: var(--orange); color: var(--navy-deep); }
.metric.is-active .metric__label,
.metric.is-active .metric__sub { color: var(--navy-deep); }
.metric.is-active .metric__sub { border-left-color: rgba(10,42,77,.28); }
.pagination a:hover { border-color: var(--orange); }
.pagination a.is-active { background: var(--orange); border-color: var(--orange); color: var(--navy-deep); }

/* Focus and form accents. */
.field-control:focus, .field-box:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(224, 138, 30, .22);
}
:focus-visible { outline-color: var(--orange); }
.piece-label input[type="checkbox"] { accent-color: var(--orange); }
progress::-webkit-progress-value { background: var(--orange); }
progress::-moz-progress-bar { background: var(--orange); }

/* Icon wells and hover grounds. */
.timeline__icon,
.state-icon,
.done-state > span { background: var(--gold-soft); color: var(--orange-deep); }
.icon-link:hover { background: var(--gold-soft); color: var(--orange-deep); }
.quick-action:hover { border-color: var(--orange); background: var(--gold-soft); }
.quick-action--primary { background: var(--orange); border-color: var(--orange); color: var(--navy-deep); }
.quick-action--primary:hover { background: var(--orange-lift); border-color: var(--orange-lift); }
.quick-action--primary small { color: rgba(10,42,77,.72); }
.nav-menu a:hover, .nav-menu__button:hover { background: var(--gold-soft); color: var(--orange-deep); }
.search-result:hover, .search-result.is-active { background: var(--gold-soft); }
.search-result__type { color: var(--orange-deep); background: var(--gold-soft); }
.action-row:hover { background: var(--gold-soft); }
.priority-dot { background: var(--orange); }
.outcome-option:hover > span { border-color: var(--orange); color: var(--orange-deep); background: var(--gold-soft); }

/* Emphasis badge, used for high priority and similar. */
.badge--accent { background: var(--gold-soft); color: var(--orange-deep); border-color: var(--gold-line); }

/* =====================================================================
   Tasks
   ===================================================================== */
.task-list { display: flex; flex-direction: column; }
.task-row {
  display: flex; align-items: flex-start; gap: .8rem;
  padding: .8rem 1.25rem; border-bottom: 1px solid var(--line-soft);
  transition: background var(--fast) ease;
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
/* An overdue task is tinted rather than outlined: a heavy left border on a
   list item is decoration, a wash reads as state. */
.task-row--late { background: linear-gradient(90deg, rgba(224,138,30,.10), transparent 45%); }
.task-row__check { display: flex; padding-top: .1rem; }

.task-check {
  width: 22px; height: 22px; border-radius: 50%; flex: none; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); padding: 0;
  display: flex; align-items: center; justify-content: center; color: transparent;
  transition: border-color var(--fast) ease, background var(--fast) ease, color var(--fast) ease;
}
.task-check .icon { width: 13px; height: 13px; stroke-width: 3; }
.task-check:hover { border-color: var(--orange); color: var(--orange); }
.task-check.is-done { background: var(--ok); border-color: var(--ok); color: #fff; }

.task-row__body { flex: 1; min-width: 0; }
.task-row__title { font-weight: 600; font-size: .9rem; color: var(--ink); }
.task-row__meta {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin-top: .25rem; font-size: .765rem; color: var(--muted);
}
.task-row__meta span { display: inline-flex; align-items: center; gap: .25rem; }
.task-row__meta .icon { width: 13px; height: 13px; }
.task-row__desc { margin: .4rem 0 0; font-size: .82rem; color: var(--ink-2); }
.task-late { color: var(--danger); font-weight: 600; }

/* =====================================================================
   Calendar
   ===================================================================== */
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.cal-nav { display: flex; align-items: center; gap: .4rem; }
.cal-nav .btn { min-height: 34px; padding: 0 .7rem; }
.cal-title { font-size: 1.15rem; margin-left: .6rem; }
.cal-controls { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cal-controls .field-control { min-height: 34px; width: auto; }

.cal-switch {
  display: inline-flex; border: 1px solid var(--line);
  border-radius: var(--r-sm); overflow: hidden; background: var(--surface);
}
.cal-switch a { padding: .4rem .85rem; font-size: .8125rem; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.cal-switch a:hover { background: var(--gold-soft); text-decoration: none; }
.cal-switch a.is-active { background: var(--orange); color: var(--navy-deep); font-weight: 600; }

.cal-legend { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: .755rem; color: var(--muted); }
.cal-legend__item { display: inline-flex; align-items: center; gap: .35rem; }
.cal-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.cal-dot--tache        { background: var(--orange); }
.cal-dot--action       { background: var(--navy-2); }
.cal-dot--rappel       { background: var(--info); }
.cal-dot--echeance     { background: var(--gold); }
.cal-dot--anniversaire { background: var(--ok); }

.cal-month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-head > div {
  padding: .5rem .7rem; font-size: .67rem; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day {
  min-height: 118px; padding: .4rem .45rem;
  border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: .2rem; min-width: 0;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day--muted { background: var(--surface-2); }
.cal-day--muted .cal-day__num { opacity: .45; }
.cal-day--today { background: var(--gold-soft); box-shadow: inset 0 0 0 2px var(--orange); }
.cal-day__num {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: .78rem; color: var(--ink-2); padding: 0 .1rem .1rem;
}
.cal-day--today .cal-day__num span {
  background: var(--orange); color: var(--navy-deep); font-weight: 600;
  border-radius: 5px; padding: 0 .3rem;
}
.cal-day__num small { color: var(--muted); font-size: .66rem; }
.cal-day__events { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }

/* Category is carried by the tint and a leading dot. An added coloured
   left bar would be a third redundant signal for the same fact — and the
   thick side rule is the tell this interface is trying not to have. */
.cal-ev {
  display: flex; align-items: baseline; gap: .3rem;
  padding: .16rem .4rem; border-radius: 4px;
  font-size: .715rem; line-height: 1.35; text-decoration: none;
  background: var(--surface-2); color: var(--ink); overflow: hidden;
}
.cal-ev::before {
  content: ''; width: 6px; height: 6px; border-radius: 2px;
  flex: none; align-self: center; background: var(--navy-2);
}
.cal-ev:hover { text-decoration: none; filter: brightness(.96); }
.cal-ev b { font-family: var(--mono); font-size: .66rem; color: var(--muted); flex: none; }
.cal-ev > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.is-done { opacity: .5; text-decoration: line-through; }
.cal-ev--tache        { background: var(--gold-soft); }
.cal-ev--tache::before        { background: var(--orange); }
.cal-ev--action       { background: var(--navy-soft); }
.cal-ev--action::before       { background: var(--navy-2); }
.cal-ev--rappel       { background: var(--info-soft); }
.cal-ev--rappel::before       { background: var(--info); }
.cal-ev--echeance     { background: var(--gold-soft); }
.cal-ev--echeance::before     { background: var(--gold); }
.cal-ev--anniversaire { background: var(--ok-soft); }
.cal-ev--anniversaire::before { background: var(--ok); }

.cal-more { font-size: .68rem; color: var(--orange-deep); padding: 0 .35rem; font-weight: 600; }

.cal-week {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
.cal-wday { border-right: 1px solid var(--line-soft); min-width: 0; display: flex; flex-direction: column; }
.cal-wday:last-child { border-right: 0; }
.cal-wday--today { background: var(--gold-soft); }
.cal-wday__head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: .55rem .7rem; border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2); font-size: .8rem;
}
.cal-wday--today .cal-wday__head { background: var(--orange); color: var(--navy-deep); }
.cal-wday--today .cal-wday__head .muted { color: rgba(10,42,77,.7); }
.cal-wday__body { padding: .45rem; display: flex; flex-direction: column; gap: .3rem; min-height: 220px; }
.cal-wday .cal-ev { flex-direction: column; align-items: stretch; gap: .05rem; padding: .35rem .45rem; }
/* align-items: stretch would smear the category dot into a full-width bar. */
.cal-wday .cal-ev::before { align-self: flex-start; }
.cal-wday .cal-ev small { color: var(--muted); font-size: .66rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-empty { color: var(--line); text-align: center; margin: .5rem 0; }

@media (max-width: 900px) {
  .cal-day { min-height: 84px; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-wday { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .cal-wday__body { min-height: 0; }
  .cal-title { width: 100%; margin: .4rem 0 0; }
}
@media (max-width: 560px) {
  .cal-head > div { padding: .4rem .25rem; font-size: .6rem; }
  .cal-day { min-height: 68px; padding: .25rem; }
  .cal-ev { padding: .1rem .2rem; font-size: .62rem; }
  .cal-ev b { display: none; }
}
