/* Canuck — shared design system (tech app, customer portal, landing).
   Clean, Apple-inspired: hairline borders, soft surfaces, restrained brand
   red accent, system typography. Class names are kept stable so the apps
   keep working; only the look changes. */
:root {
  /* Brand accent */
  --rouge: #c00000;
  --rouge-d: #9a0000;
  /* Status */
  --ok: #1d7a3e;   --ok-bg: #e7f4ec;
  --nc: #c00000;   --nc-bg: #fcebec;
  --todo: #8a6500; --todo-bg: #fff5da;
  /* Neutrals (Apple-ish) */
  --bg: #fbfbfd;
  --bg-2: #f5f5f7;
  --card: #ffffff;
  --line: #d2d2d7;
  --line-2: #ebebef;
  /* Text — keep legacy names (--txt/--muted) as aliases so existing
     inline var() references across the apps keep resolving. */
  --txt: #1d1d1f;  --ink: #1d1d1f;
  --muted: #6e6e73; --ink-2: #6e6e73;
  --ink-3: #86868b;
  /* Shape */
  --radius: 18px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 10px 30px rgba(0,0,0,.05);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Ensure the hidden attribute always wins over display rules below
   (e.g. .icon-btn/.fab set display, which would otherwise show them). */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--txt);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-size: 16px; line-height: 1.47; letter-spacing: -0.011em;
  padding-bottom: 92px;
}
svg { display: block; }

/* Top bar — frosted, hairline divider, dark text (Apple nav). */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  background: rgba(251,251,253,.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-2);
  color: var(--txt);
  padding: max(env(safe-area-inset-top), 11px) 16px 11px;
}
.topbar h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 600; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  background: transparent; border: none; color: var(--rouge);
  width: 38px; height: 38px; border-radius: 50%; padding: 0;
  cursor: pointer; display: grid; place-items: center;
  transition: background .15s ease;
}
.icon-btn:active { background: rgba(0,0,0,.06); }
.icon-btn svg { width: 23px; height: 23px; }
.sync { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #ff453a; }
.dot.online { background: #34c759; }
#syncBtn.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout */
main { padding: 16px; max-width: 760px; margin: 0 auto; }
.section-title { font-size: 13px; letter-spacing: -0.01em; color: var(--muted);
  margin: 26px 4px 10px; font-weight: 600; }

/* Cards / list */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line-2); box-shadow: none;
  padding: 16px 18px; margin-bottom: 10px; cursor: pointer;
  display: flex; align-items: center; gap: 14px;
  transition: border-color .15s ease, transform .05s ease;
}
.card:hover { border-color: var(--line); }
.card:active { transform: scale(.995); }
.card .grow { flex: 1; min-width: 0; }
.card .ttl { font-weight: 600; font-size: 16px; letter-spacing: -0.015em; }
.card .sub { color: var(--muted); font-size: 14px; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .chev { color: var(--ink-3); font-size: 20px; font-weight: 400; line-height: 1; }
.card .lead { width: 30px; height: 30px; flex: none; display: grid; place-items: center; color: var(--rouge); }
.card .lead svg { width: 24px; height: 24px; }

.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 980px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.nc { background: var(--nc-bg); color: var(--nc); }
.pill.todo { background: var(--todo-bg); color: var(--todo); }
.pill.kind { background: var(--bg-2); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 64px 20px; }
.empty .big { display: flex; justify-content: center; margin-bottom: 14px; color: var(--ink-3); opacity: .5; }
.empty .big svg { width: 46px; height: 46px; }
.empty p { font-size: 15px; line-height: 1.5; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted);
  font-weight: 500; margin-bottom: 6px; letter-spacing: -0.01em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; font-size: 16px; border: 1px solid var(--line);
  border-radius: var(--radius-s); background: var(--card); font-family: inherit; color: var(--txt);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--rouge); box-shadow: 0 0 0 3px rgba(192,0,0,.12);
}
.field textarea { min-height: 90px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn { display: block; width: 100%; padding: 13px 18px; border: none; border-radius: var(--radius-s);
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em; cursor: pointer; background: var(--rouge);
  color: #fff; margin-top: 8px; transition: background .15s ease, transform .05s ease, opacity .15s ease; }
.btn:hover { background: var(--rouge-d); }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sec { background: var(--bg-2); color: var(--txt); }
.btn.sec:hover { background: #ececef; }
.btn.ghost { background: transparent; color: var(--rouge); }
.btn.ghost:hover { background: rgba(192,0,0,.06); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Checklist */
.check {
  display: flex; align-items: center; gap: 12px; padding: 14px 4px;
  border-bottom: 1px solid var(--line-2);
}
.check:last-child { border-bottom: none; }
.check .clabel { flex: 1; font-size: 15px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: none; border-left: 1px solid var(--line); background: var(--card);
  padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); min-width: 46px; }
.seg button:first-child { border-left: none; }
.seg button.on.ok { background: var(--ok); color: #fff; }
.seg button.on.def { background: var(--nc); color: #fff; }
.seg button.on.so { background: var(--muted); color: #fff; }

.fab {
  position: fixed; right: 20px; bottom: calc(22px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%; border: none; background: var(--rouge);
  color: #fff; display: grid; place-items: center; box-shadow: 0 4px 16px rgba(192,0,0,.32);
  cursor: pointer; z-index: 15; transition: transform .1s ease, background .15s ease;
}
.fab:hover { background: var(--rouge-d); }
.fab:active { transform: scale(.94); }
.fab svg { width: 26px; height: 26px; }

.banner { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line-2);
  padding: 20px; margin-bottom: 14px; }
.banner .big-num { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.banner .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.stat-row { display: flex; gap: 12px; }
.stat { flex: 1; text-align: center; background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line-2); padding: 16px 8px; }
.stat .n { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }

.toast { position: fixed; bottom: 104px; left: 50%; transform: translateX(-50%);
  background: rgba(29,29,31,.92); color: #fff; padding: 12px 20px; border-radius: 14px;
  font-size: 14px; font-weight: 500; z-index: 50; -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px); box-shadow: 0 8px 30px rgba(0,0,0,.22); max-width: 90%; }
a.dl { color: var(--rouge); font-weight: 600; text-decoration: none; }

/* Photos */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ph-empty { color: var(--muted); font-size: 14px; padding: 6px 2px; }
.photo-card { background: var(--card); border-radius: 14px; border: 1px solid var(--line-2);
  padding: 8px; display: flex; flex-direction: column; gap: 7px; }
.photo-card img { width: 100%; height: 130px; object-fit: cover; border-radius: 9px; background: var(--bg-2); }
.photo-card select, .photo-card input { width: 100%; padding: 8px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px; }
.ph-del { border: none; background: transparent; color: var(--rouge); font-weight: 600;
  font-size: 13px; cursor: pointer; padding: 3px; }

/* Échéances */
.ech-panel { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line-2); padding: 4px 18px; }
.ech-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--line-2); }
.ech-row:last-child { border-bottom: none; }
.ech-lbl { font-size: 15px; }
.ech-empty { color: var(--muted); font-size: 14px; padding: 14px 0; }
.card.dash { border-left: 3px solid var(--rouge); }
.card.dash .ttl { color: var(--rouge); }
.ech-warn { background: var(--todo-bg); color: var(--todo); font-size: 13px; font-weight: 500;
  padding: 10px 13px; border-radius: 10px; margin: 10px 0; }
.save-status { text-align: center; font-size: 13px; color: var(--muted); min-height: 18px; margin: 4px 0 8px; }
.save-status.ok { color: var(--ok); font-weight: 600; }
.ready { font-size: 13.5px; font-weight: 500; text-align: center; padding: 11px 14px;
  border-radius: 12px; margin-bottom: 14px; background: var(--todo-bg); color: var(--todo); }
.ready.on { background: var(--ok-bg); color: var(--ok); }
.card.tech.sel { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(29,122,62,.12); }
.sig-block { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line-2); padding: 14px; margin-bottom: 10px; }
.sig-label { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.sigpad { width: 100%; height: 150px; display: block; background: var(--card);
  border: 1px dashed var(--line); border-radius: 12px; touch-action: none; }

/* --- Report-parity additions: cover accordion, monthly grid, hints ------- */
details.acc { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius-s);
  margin-bottom: 10px; overflow: hidden; }
details.acc > summary { cursor: pointer; padding: 12px 14px; font-size: 14px; font-weight: 600;
  color: var(--txt); list-style: none; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "+"; float: right; color: var(--muted); font-weight: 400; }
details.acc[open] > summary::after { content: "−"; }
.acc-body { padding: 0 14px 12px; border-top: 1px solid var(--line-2); }
.hint { font-size: 13px; color: var(--muted); margin: 2px 0 12px; line-height: 1.4; }
.mc-block { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius-s);
  padding: 12px; margin-bottom: 10px; }
.mc-head { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.mc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.mc-cell { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.mc-cell input { width: 100%; padding: 7px 8px; font-size: 13px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--txt); }
.mc-notes { width: 100%; padding: 8px 10px; font-size: 13px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--txt); }

/* --- Calendrier (roadmap 01) --------------------------------------------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-size: 16px; font-weight: 600; text-transform: capitalize; }
.cal-head .icon-btn { font-size: 22px; line-height: 1; color: var(--txt); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 10px; margin-bottom: 16px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 0 6px; }
.cal-cell { position: relative; aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; border-radius: 10px; cursor: pointer; }
.cal-cell:active { background: rgba(0,0,0,.05); }
.cal-cell.off { cursor: default; }
.cal-cell.today { background: var(--bg-2); box-shadow: inset 0 0 0 1.5px var(--rouge); }
.cal-n { font-size: 13px; color: var(--txt); }
.cal-dot { position: absolute; bottom: 4px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--todo-bg); color: var(--todo);
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.cal-dot.late { background: var(--nc-bg); color: var(--nc); }

/* --- Tableau de bord (roadmap 12) ----------------------------------------- */
.stat.tap { cursor: pointer; }
.stat.tap:active { transform: scale(.98); }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.bar-lbl { font-size: 13px; color: var(--muted); width: 86px; flex: none; }
.bar-track { flex: 1; height: 8px; background: var(--bg-2); border-radius: 980px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 980px; background: var(--rouge);
  transition: width .3s ease; }
.bar-n { font-size: 13px; font-weight: 600; width: 30px; text-align: right; flex: none; }
details.fold { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 0 16px; margin: 10px 0; }
details.fold > summary { cursor: pointer; padding: 14px 0; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-weight: 600; font-size: 15px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold[open] > summary { border-bottom: 1px solid var(--line-2); }
details.fold .card { margin: 10px 0; }
