/* ==================================================================
 * DrNiko × Clinique Eiffel — shared structure.
 * Theme-agnostic: every colour/font is a CSS custom property supplied
 * by theme-eiffel.css or theme-techniko.css. Do not hardcode hex here.
 * RTL (Arabic) is handled with logical properties + [dir=rtl] overrides.
 * ================================================================== */

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

html, body {
  margin: 0; padding: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 0 24px; }

/* ---------------- header ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bar, var(--surface));
  color: var(--bar-ink, var(--ink));
  border-bottom: 1px solid var(--bar, var(--line));
  backdrop-filter: blur(8px);
}
.topbar-in {
  display: flex; align-items: center; gap: 20px;
  height: 62px; max-width: 1120px; margin: 0 auto; padding: 0 24px;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.05rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--bar-accent, var(--accent)); font-weight: 600; white-space: nowrap;
}
.brand small {
  display: block; font-family: var(--font-sans); font-size: .62rem;
  letter-spacing: .18em; color: var(--bar-muted, var(--ink-muted)); font-weight: 500;
}
.navlinks { display: flex; gap: 4px; margin-inline-start: auto; flex-wrap: wrap; }
.navlinks a {
  padding: 7px 13px; border-radius: var(--pill, 999px); font-size: .84rem;
  color: var(--bar-muted, var(--ink-muted)); text-decoration: none; white-space: nowrap;
}
.navlinks a:hover { color: var(--bar-ink, var(--ink)); text-decoration: none; }
.navlinks a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }

/* ---------------- type ---------------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: var(--display-weight, 600); line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.7rem); }
h3 { font-size: 1.03rem; }
.eyebrow {
  font-size: .68rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 14px;
}
.lede { font-size: 1.08rem; color: var(--ink-muted); max-width: 62ch; }
.muted { color: var(--ink-muted); }
.tiny { font-size: .78rem; }

/* ---------------- surfaces ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--pill, 999px); border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: .9rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: var(--pill, 999px);
  font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  background: var(--accent-wash); color: var(--accent-ink);
}

/* ---------------- chat ---------------- */
.chat-shell {
  display: grid; grid-template-columns: 260px 1fr; gap: 0;
  height: calc(100vh - 62px); min-height: 520px;
}
@media (max-width: 820px) { .chat-shell { grid-template-columns: 1fr; } .chat-side { display: none; } }

.chat-side {
  border-inline-end: 1px solid var(--line); background: var(--surface);
  padding: 22px 18px; overflow-y: auto;
}
.chat-side h3 { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-muted); font-family: var(--font-sans); margin: 22px 0 9px; }
.chat-side h3:first-child { margin-top: 0; }
.side-btn {
  display: block; width: 100%; text-align: start; margin-bottom: 5px;
  padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--page); color: var(--ink); font: inherit; font-size: .82rem;
  cursor: pointer; line-height: 1.35;
}
.side-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.side-btn.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.chat-main { display: flex; flex-direction: column; min-width: 0; background: var(--page); }
.chat-log { flex: 1; overflow-y: auto; padding: 26px 24px 8px; }
.chat-inner { max-width: 720px; margin: 0 auto; }

.msg { display: flex; gap: 12px; margin-bottom: 20px; }
.msg-av {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: .7rem; font-weight: 700;
  background: var(--accent); color: var(--on-accent);
}
.msg.user .msg-av { background: var(--surface-2); color: var(--ink-muted); }
.msg-body { min-width: 0; padding-top: 4px; }
.msg-who { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 700; margin-bottom: 4px; }
.msg-text { white-space: pre-wrap; word-wrap: break-word; }
.msg-text strong { color: var(--accent-ink); }
.msg-text a { text-decoration: underline; }

.typing span {
  display: inline-block; width: 6px; height: 6px; margin-inline-end: 4px;
  border-radius: 50%; background: var(--ink-muted); animation: bob 1.1s infinite;
}
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes bob { 0%,60%,100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

.chat-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 14px 24px 18px; }
.chat-foot-in { max-width: 720px; margin: 0 auto; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 11px; }
.chip {
  padding: 6px 13px; border-radius: var(--pill, 999px); border: 1px solid var(--line);
  background: var(--page); color: var(--ink-muted); font: inherit; font-size: .78rem; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; min-height: 46px; max-height: 160px;
  padding: 12px 15px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--page); color: var(--ink); font: inherit; font-size: .93rem;
}
.composer textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.disclaimer { font-size: .7rem; color: var(--ink-muted); margin-top: 9px; text-align: center; }

/* ---------------- forms (bilan) ---------------- */
.field { margin-bottom: 20px; }
.field > label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 9px; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; }
.opt {
  padding: 9px 15px; border-radius: var(--pill, 999px); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .85rem; cursor: pointer;
}
.opt:hover { border-color: var(--accent); }
.opt[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
input[type="text"], input[type="number"], select, textarea.plain {
  width: 100%; padding: 11px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
}
.progress { height: 4px; background: var(--surface-2); border-radius: var(--pill, 999px); overflow: hidden; margin-bottom: 26px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }

/* ---------------- alerts ---------------- */
.alert {
  display: flex; gap: 11px; padding: 13px 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface-2); font-size: .88rem;
}
.alert-icon { flex: none; font-weight: 700; }
.alert.warn  { border-color: var(--st-warning);  }
.alert.warn .alert-icon  { color: var(--st-warning-ink); }
.alert.crit  { border-color: var(--st-critical); }
.alert.crit .alert-icon  { color: var(--st-critical); }
.alert.good  { border-color: var(--st-good); }
.alert.good .alert-icon  { color: var(--st-good); }

/* ---------------- dashboard ---------------- */
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px 19px; }
.kpi .k-label { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted); font-weight: 700; }
.kpi .k-val { font-family: var(--font-display); font-size: 2rem; line-height: 1.1; margin: 7px 0 3px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: .78rem; color: var(--ink-muted); }
.delta-up   { color: var(--st-good); font-weight: 600; }
.delta-down { color: var(--st-critical); font-weight: 600; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .87rem; }
table.tbl th {
  text-align: start; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .8rem; white-space: nowrap; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.st-good .dot { background: var(--st-good); }
/* Shape is a second, font-independent channel: a status is never colour-alone,
   and does not depend on a glyph the body font may not ship. */
.st-warn .dot { background: var(--st-warning); border-radius: 2px; transform: rotate(45deg); }
.st-crit .dot { background: var(--st-critical); border-radius: 1px;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%); width: 11px; height: 10px; }
.st-good { color: var(--st-good-ink); }
.st-warn { color: var(--st-warning-ink); }
.st-crit { color: var(--st-critical); }

/* chart chrome */
.chart-title { font-size: .93rem; font-weight: 600; margin-bottom: 2px; }
.chart-sub { font-size: .76rem; color: var(--ink-muted); margin-bottom: 14px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-muted); margin-top: 10px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
svg .grid-line { stroke: var(--line); stroke-width: 1; }
svg .axis-txt { fill: var(--ink-muted); font-size: 10px; font-family: var(--font-sans); }
svg .val-txt  { fill: var(--ink); font-size: 10px; font-weight: 600; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }

.footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 28px 0 46px; color: var(--ink-muted); font-size: .82rem; }

/* ---------------- language switch (FR/RU on pitch pages, FR/EN/AR in chat) ---------------- */
.lang { display:flex; gap:3px; border:1px solid var(--bar-muted, var(--line)); border-radius:var(--pill, 999px); padding:3px; margin-inline-start: 8px; }
.lang button {
  border:none; background:transparent; color:var(--bar-muted, var(--ink-muted)); font:inherit;
  font-size:.74rem; font-weight:700; letter-spacing:.06em; padding:4px 10px;
  border-radius:var(--pill, 999px); cursor:pointer;
}
.lang button[aria-pressed="true"] { background:var(--accent); color:var(--on-accent); }

/* ---------------- right-to-left (Arabic) ---------------- */
[dir="rtl"] .msg-text, [dir="rtl"] .composer textarea { line-height: 1.85; font-size: 1.05rem; }
[dir="rtl"] .eyebrow, [dir="rtl"] .msg-who { letter-spacing: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------------- timeline (parcours) ---------------- */
.tl { position: relative; padding-inline-start: 28px; }
.tl::before { content:""; position:absolute; inset-inline-start: 7px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 22px; }
.tl-item::before {
  content:""; position:absolute; inset-inline-start: -26px; top: 5px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--accent);
}
.tl-item.done::before { background: var(--accent); }
.tl-when { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); font-weight: 700; }
.tl-item h3 { margin: 3px 0 4px; font-size: 1rem; }
.tl-item p { margin: 0; font-size: .88rem; color: var(--ink-muted); }

/* ---------------- phone mock ---------------- */
.phone {
  width: 350px; max-width: 100%; border: 1px solid var(--line); border-radius: 30px;
  background: var(--surface); padding: 14px 12px 16px; box-shadow: 0 18px 50px rgba(0,0,0,.10);
}
.phone-top { text-align: center; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-muted); padding: 4px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.bub { width: fit-content; max-width: 86%; padding: 9px 12px; border-radius: 14px; font-size: .84rem; margin-bottom: 8px; line-height: 1.45; }
.bub.in  { background: var(--surface-2); border: 1px solid var(--line); border-end-start-radius: 4px; }
.bub.out { background: var(--accent); color: var(--on-accent); margin-inline-start: auto; border-end-end-radius: 4px; }
.bub .t { display:block; font-size: .66rem; opacity: .7; margin-top: 4px; }
.quick { display:flex; gap:6px; flex-wrap:wrap; margin: 4px 0 10px; }
.quick span { font-size: .74rem; padding: 5px 10px; border: 1px solid var(--accent); color: var(--accent-ink); border-radius: var(--pill, 999px); }

/* ---------------- print ---------------- */
@media print { .topbar, .noprint { display:none !important; } .card, .finding { break-inside: avoid; } }
