:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --fg: #14161a;
  --muted: #6b7280;
  --line: #e3e5ea;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --accent-fg: #ffffff;
  --pos: #12874a;
  --neg: #c62828;
  --warn: #b45309;
  --warn-soft: #fff5e6;
  --r: 14px;
  --nav-h: 62px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101216;
    --card: #191c22;
    --fg: #e9ecf1;
    --muted: #9aa2b1;
    --line: #272b34;
    --accent: #7c74ff;
    --accent-soft: #232343;
    --pos: #3ecf8e;
    --neg: #ff6b6b;
    --warn: #f0b429;
    --warn-soft: #2d2415;
  }
}

:root[data-theme="dark"] {
  --bg: #101216;
  --card: #191c22;
  --fg: #e9ecf1;
  --muted: #9aa2b1;
  --line: #272b34;
  --accent: #7c74ff;
  --accent-soft: #232343;
  --pos: #3ecf8e;
  --neg: #ff6b6b;
  --warn: #f0b429;
  --warn-soft: #2d2415;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior-y: none;
}

#top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: max(8px, env(safe-area-inset-top)) 16px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}
#top h1 { font-size: 17px; margin: 0; font-weight: 650; flex: 1; }
#top .sub { font-size: 12px; color: var(--muted); font-weight: 400; display: block; }

main {
  padding: 14px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 760px;
  margin: 0 auto;
}

nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  flex: 1;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  padding: 8px 2px 10px;
  height: var(--nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}
nav button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav button.on { color: var(--accent); font-weight: 600; }

/* --- blocs --- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }

.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .k { color: var(--muted); font-size: 14px; }
.row .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.row.total { border-top: 2px solid var(--line); margin-top: 4px; padding-top: 10px; }
.row.total .k { color: var(--fg); font-weight: 600; }

.hero { text-align: center; padding: 20px 14px; }
.hero .label { font-size: 13px; color: var(--muted); }
.hero .amount { font-size: 38px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.hero .hint { font-size: 12px; color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* --- contrôles --- */

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; width: 100%;
  background: var(--accent); color: var(--accent-fg);
  border: 0; border-radius: 12px; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: .45; }
.btn.ghost { background: var(--card); color: var(--fg); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--neg); border: 1px solid var(--line); }
.btn.sm { min-height: 38px; width: auto; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn.icon { padding: 0; width: 38px; flex: 0 0 38px; }
.btn.icon svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.seg button { flex: 1; min-height: 44px; background: var(--card); border: 0; color: var(--muted); font-size: 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }

.invite { background: var(--accent-soft); border-color: var(--accent); }
.invite input { background: var(--card); font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.invite a.btn { text-decoration: none; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 11px 13px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.inline > * { flex: 1; min-width: 120px; }

/* --- saisie rapide --- */

.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps div { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps div.on { background: var(--accent); }

.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick button {
  min-height: 72px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  text-align: left; font-weight: 600; cursor: pointer; line-height: 1.25;
}
.pick button:active { border-color: var(--accent); background: var(--accent-soft); }
.pick button small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 3px; }
.pick.days { grid-template-columns: repeat(3, 1fr); }
.pick.days button { min-height: 62px; text-align: center; }
.pick button.wide { grid-column: 1 / -1; min-height: 52px; text-align: center; }

.list button.opt {
  display: block; width: 100%; text-align: left; min-height: 50px; padding: 13px;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 8px; cursor: pointer;
}
.list button.opt.arch { color: var(--muted); }

.timer { text-align: center; padding: 6px 0 14px; }
.timer .big { font-size: 46px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.timer .ctx { font-size: 13px; color: var(--muted); }
.adds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.adds button { min-height: 62px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 17px; font-weight: 650; cursor: pointer; }
.adds button:active { background: var(--accent-soft); border-color: var(--accent); }
.adds.minor { grid-template-columns: repeat(2, 1fr); }
.adds.minor button { min-height: 44px; font-size: 14px; font-weight: 500; color: var(--muted); }

/* --- listes --- */

.day { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 6px; font-weight: 600; }
.item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 13px; margin-bottom: 7px;
}
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .amt { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.item.pending { border-style: dashed; }
.item.rowset { flex-wrap: wrap; gap: 8px; }
.item.rowset .main { flex: 1 0 100%; }
.item.rowset .btn { flex: 1 1 auto; }
.x { background: none; border: 0; color: var(--muted); font-size: 20px; padding: 4px 6px; cursor: pointer; }
.x:hover { color: var(--fg); }

.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

.note { font-size: 13px; color: var(--muted); padding: 6px 0; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 11px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.banner button { background: none; border: 0; color: inherit; text-decoration: underline; padding: 0; cursor: pointer; font-size: 13px; }
.banner.install { background: var(--accent-soft); color: var(--fg); border: 1px solid var(--accent); padding: 14px; }
.banner.install .btn { flex: 0 1 auto; text-decoration: none; background: var(--accent); color: var(--accent-fg); }
.banner.install .btn.ghost { background: var(--card); color: var(--fg); border: 1px solid var(--line); }
.err { color: var(--neg); font-size: 14px; margin-bottom: 10px; }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: 14px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; }
.tabs button { white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; }

/* --- graphiques --- */

:root { --chart: #4f46e5; --chart-over: #d03b3b; --chart-track: #eceef3; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --chart: #7c74ff; --chart-over: #e66767; --chart-track: #23262e; }
}
:root[data-theme="dark"] { --chart: #7c74ff; --chart-over: #e66767; --chart-track: #23262e; }

.bar { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; margin-bottom: 11px; }
.bar:last-child { margin-bottom: 0; }
.bar .l { font-size: 13px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .v { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bar .t { grid-column: 1 / -1; height: 10px; background: var(--chart-track); border-radius: 2px; }
.bar .f { height: 100%; background: var(--chart); border-radius: 2px 4px 4px 2px; min-width: 2px; }
.bar .f.over { background: var(--chart-over); }
.bar .s { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.bar .s.over { color: var(--chart-over); font-weight: 600; }

.cols { display: flex; align-items: flex-end; gap: 4px; height: 132px; margin: 6px 0 4px; }
.cols .c { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 3px; min-width: 0; }
.cols .c .b { background: var(--chart); border-radius: 4px 4px 2px 2px; min-height: 2px; }
.cols .c .n { font-size: 10px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.colx { display: flex; gap: 4px; }
.colx div { flex: 1; font-size: 10px; color: var(--muted); text-align: center; min-width: 0; overflow: hidden; }

.kpi { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi .stat .v { font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .tag { cursor: default; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: calc(100% - 32px); max-width: 420px;
}
#toast div {
  background: #14161a; color: #fff; padding: 11px 16px; border-radius: 11px;
  font-size: 14px; box-shadow: 0 8px 26px rgba(0,0,0,.25); text-align: center;
}
#toast div.bad { background: var(--neg); }

.login { max-width: 360px; margin: 8vh auto 0; }
.login .logo { text-align: center; margin-bottom: 26px; }
.login .logo svg { width: 56px; height: 56px; }
.login .logo div { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; }
.login .logo small { color: var(--muted); font-weight: 400; }

@media (min-width: 620px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .pick { grid-template-columns: repeat(3, 1fr); }
  .pick.days { grid-template-columns: repeat(6, 1fr); }
}

/* --- tableaux (cartes empilées sur mobile, vraies tables sur desktop) --- */

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 6px 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover, .tbl th.sorted { color: var(--accent); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .act { text-align: right; white-space: nowrap; }
.tbl .main { font-weight: 600; }
.tbl .muted { color: var(--muted); }
.tbl .grp td { background: var(--bg); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; }
.tbl .barc { width: 32%; }
.tbl .barc .t { height: 10px; background: var(--chart-track); border-radius: 2px; }
.tbl .barc .f { height: 100%; background: var(--chart); border-radius: 2px 4px 4px 2px; min-width: 2px; }
.tbl tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.tbl .x { font-size: 18px; }

@media (max-width: 959px) {
  .tablecard { padding: 0; border: 0; background: none; }
  .tablecard > h2 { padding: 0 2px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl tr { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 9px 13px; margin-bottom: 7px; }
  .tbl tr.pending { border-style: dashed; }
  .tbl td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; border: 0; }
  .tbl td:empty { display: none; }
  .tbl td::before { content: attr(data-l); color: var(--muted); font-size: 12px; flex: 0 0 auto; }
  .tbl td.main, .tbl td.plain, .tbl td.barc { display: block; }
  .tbl td.main::before, .tbl td.plain::before, .tbl td.barc::before, .tbl td.act::before, .tbl td.nol::before { display: none; }
  .tbl td.nol { justify-content: flex-end; font-weight: 650; font-size: 15px; }
  .tbl td.main { font-size: 15px; }
  .tbl td.act { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-top: 2px; white-space: normal; text-align: right; }
  .tbl td.barc { padding: 6px 0 2px; }
  .tbl tr.grp { background: none; border: 0; padding: 0; margin: 16px 0 6px; }
  .tbl tr.grp td { padding: 0; background: none; }
  .tbl tr.total { background: var(--accent-soft); }
  .tbl tr.total td { border-top: 0; }
}

/* --- accueil : rapport --- */

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.period { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.period select { min-height: 40px; width: auto; padding: 6px 30px 6px 12px; }
.period .btn.icon { width: 40px; flex-basis: 40px; min-height: 40px; font-size: 20px; }
.period-label { font-size: 13px; color: var(--muted); padding: 0 6px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 10px; }
.totals { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 12px 16px; }
.totals .kv { font-size: 13px; color: var(--muted); white-space: nowrap; }
.totals .kv b { color: var(--fg); font-size: 16px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.totals .kv b.pos { color: var(--pos); }
.totals .kv b.neg { color: var(--neg); }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.switch input { width: 18px; height: 18px; min-height: 18px; margin: 0; }

.chart { position: relative; height: 210px; margin: 26px 0 6px; }
.chart .gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.chart .gl span { position: absolute; left: 0; top: -15px; font-size: 10px; color: var(--muted); }
.chart .cols2 { position: absolute; left: 40px; right: 0; top: 0; bottom: 0; display: flex; align-items: flex-end; gap: 6px; }
.chart .c { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; min-width: 0; }
.chart .c .bs { width: 100%; flex: 0 0 auto; }
.chart .c .bs + .bs { margin-top: 2px; }
.chart .c .bs:first-of-type { border-radius: 4px 4px 0 0; }
.chart .c .bs.zero { height: 2px; background: var(--line); border-radius: 0; }
.chart .c .lbl { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
.chart-x { display: flex; gap: 6px; margin-left: 40px; }
.chart-x div { flex: 1; text-align: center; font-size: 11px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }

.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.badge { display: inline-block; min-width: 24px; padding: 2px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; text-align: center; margin-right: 8px; }
.rowbtn { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font-weight: 600; color: inherit; }
.tbl tr.sub td { background: var(--bg); font-size: 13px; font-weight: 400; padding-top: 6px; padding-bottom: 6px; }
.tbl tr.sub td.main { padding-left: 40px; }
.donut { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.donut svg { width: 220px; height: 220px; }
.legend { font-size: 13px; width: 100%; }
.legend div { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.legend div:first-child { border-top: 0; }

.edit-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* --- workspaces, API --- */

.ws-sel { width: auto; max-width: 220px; min-height: 38px; padding: 6px 30px 6px 10px; font-size: 14px; }
#top { flex-wrap: wrap; }
pre.snip { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0;
  font-size: 12px; overflow-x: auto; white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.tbl td input[type=checkbox] { width: 18px; height: 18px; min-height: 18px; margin: 0; }

nav .wsbox { display: none; }
#top .wsname { font-weight: 400; color: var(--muted); font-size: .8em; }
#top .ws-sel { border-color: var(--accent); order: 10; flex: 1 1 100%; max-width: none; font-weight: 600; background: var(--accent-soft); }
@media (max-width: 959px) { #top .wsname { display: none; } }
@media (min-width: 960px) {
  #top .ws-sel { display: none; }
  nav .wsbox { display: block; margin: 0 4px 16px; padding: 10px; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent-soft); }
  nav .wslabel { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; margin: 0 2px 6px; }
  nav .wsbox .ws-sel { width: 100%; max-width: none; background: var(--card); font-weight: 600; }
}

.wspick { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.wsrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; }
.wsrow + .wsrow { border-top: 1px solid var(--line); }
.wsrow label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg); margin: 0; cursor: pointer; }
.wsrow input[type=checkbox] { width: 18px; height: 18px; min-height: 18px; margin: 0; }
.wsrow select { width: auto; min-height: 34px; padding: 4px 28px 4px 8px; font-size: 13px; }
.tag.plain { background: var(--bg); color: var(--muted); }

.actrate { margin-top: 4px; }
.actrate input { width: 90px; min-height: 30px; height: 30px; padding: 3px 8px; font-size: 13px; display: inline-block; }

/* --- tags --- */

.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; vertical-align: middle; margin-left: 6px; }
.tag .tx { background: none; border: 0; padding: 0 0 0 5px; margin: 0; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; opacity: .55; }
.tag .tx:hover { opacity: 1; }
.tagadd { border: 1px dashed var(--line); background: none; color: var(--muted); border-radius: 999px; font-size: 11px; padding: 2px 9px; cursor: pointer; font-weight: 600; }
.tagadd:hover { border-color: var(--accent); color: var(--accent); }
.tagform { display: inline-flex; gap: 3px; align-items: center; }
.tagform input { min-height: 28px; height: 28px; padding: 2px 9px; width: 130px; font-size: 13px; border-radius: 999px; }
.tagform button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; width: 28px; height: 28px; cursor: pointer; color: var(--fg); padding: 0; }
.tagform button[type=submit] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.tagbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.tagbar .tf { border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.tagbar .tf:hover { border-color: var(--accent); }
.tagbar .tf.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.tagbar .tf.clear { border-style: dashed; color: var(--muted); }

/* --- page Projets --- */

.projbar { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.projbar select, .projbar input { min-height: 42px; padding: 8px 11px; }
.projbar input { grid-column: 1 / -1; }
.projnew { display: flex; gap: 8px; margin-top: 10px; }
.projnew input { min-height: 42px; }
.projnew .btn { flex: 0 0 auto; }
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--accent-soft); border-color: var(--accent); }
.bulk select { width: auto; min-height: 38px; padding: 6px 30px 6px 10px; }
.prog { display: flex; align-items: center; gap: 8px; }
.prog .t { flex: 1; height: 8px; background: var(--chart-track); border-radius: 2px; min-width: 60px; }
.prog .f { height: 100%; background: var(--chart); border-radius: 2px 4px 4px 2px; min-width: 2px; }
.prog .f.over { background: var(--chart-over); }
.prog span { font-size: 12px; white-space: nowrap; }
.tbl tr.dim td { opacity: .6; }
@media (min-width: 960px) {
  .projtbl td.main { min-width: 240px; }
  .projtbl .barc { width: 18%; }
  .projtbl td:nth-last-child(2) { white-space: nowrap; }
}
.tbl th.chk, .tbl td.chk { width: 34px; }
.tbl .chk input { width: 18px; height: 18px; min-height: 18px; margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; width: 0; min-height: 0; }
.swatches span { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--fg); }
@media (max-width: 959px) {
  .tbl td.chk { position: absolute; right: 12px; top: 10px; }
  .tbl td.chk::before { display: none; }
  .tbl tr { position: relative; }
  .tbl td.barc .prog { width: 100%; }
}

/* --- desktop --- */

nav .brand, nav .navfoot { display: none; }

/* palier 1 (>= 960) : barre latérale, contenu large, tables ; tout reste en une colonne */
@media (min-width: 960px) {
  body { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
  body.bare { display: block; }

  body.bare nav { display: none; }
  nav {
    grid-column: 1; grid-row: 1 / 3; align-self: start;
    position: sticky; top: 0; left: auto; right: auto; bottom: auto; height: 100vh;
    flex-direction: column; align-items: stretch;
    border-top: 0; border-right: 1px solid var(--line);
    padding: 18px 12px; gap: 4px;
  }
  nav .brand { display: flex; align-items: center; gap: 10px; padding: 6px 12px 22px; font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
  nav .brand svg { width: 28px; height: 28px; }
  nav button { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px; height: 44px; padding: 0 14px; font-size: 14px; border-radius: 10px; font-weight: 500; }
  nav button.on { background: var(--accent-soft); }
  nav button:hover:not(.on) { background: var(--bg); color: var(--fg); }
  nav .navfoot { display: block; margin-top: auto; padding: 12px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

  #top { grid-column: 2; grid-row: 1; padding: 14px 28px; }
  #top h1 { font-size: 20px; }
  main { grid-column: 2; grid-row: 2; max-width: 1320px; width: 100%; margin: 0; padding: 24px 28px 60px; }
  #toast { left: auto; right: 28px; transform: none; bottom: 28px; align-items: flex-end; }

  .stack > .card { margin-bottom: 16px; }
  .grid, .kpi { grid-template-columns: repeat(4, 1fr); }
  .pick { grid-template-columns: repeat(4, 1fr); }
  .pick.days { grid-template-columns: repeat(6, 1fr); }
  .card { padding: 18px 20px; }
  .hero .amount { font-size: 44px; }
  .login { margin-top: 14vh; }
  .timer .big { font-size: 60px; }
  .adds button { min-height: 72px; font-size: 19px; }
  .steps { max-width: 420px; }
  .narrow { max-width: 940px; }

  .card .tabs { flex-wrap: wrap; overflow: visible; }
  .admin > .tabs { flex-wrap: wrap; overflow: visible; }
  .item.rowset .main { flex: 1 1 200px; }
  .item.rowset .btn { flex: 0 0 auto; }
  .tbl tbody tr:not(.grp):not(.total):hover td { background: var(--accent-soft); }
  .cols { height: 200px; }
  .tbl tr.sub td.main { padding-left: 56px; }
  .bar .t { height: 12px; }
  .banner.install { max-width: 720px; }
  .gside > form.card { margin-bottom: 16px; }
}

/* palier 2 (>= 1180) : sous-navigation admin verticale, grilles à deux colonnes */
@media (min-width: 1180px) {
  body { grid-template-columns: 236px minmax(0, 1fr); }
  #top { padding: 14px 32px; }
  main { padding: 26px 32px 60px; }

  .g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .home-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .home-split > .card { margin-bottom: 0; }
  .projbar { grid-template-columns: 150px 200px 140px 160px minmax(0, 1fr); }
  .projbar input { grid-column: auto; }
  .projnew { max-width: 520px; }
  .chart { height: 260px; }
  .g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; align-items: start; }
  .g2 > .card, .g3 > .card, .g2 > .stat, .g3 > .stat { margin-bottom: 0; }
  .span2 { grid-column: 1 / -1; }

  .admin { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 26px; align-items: start; }
  .admin > .tabs { flex-direction: column; flex-wrap: nowrap; position: sticky; top: 84px; margin: 0; }
  .admin > .tabs button { text-align: left; border-radius: 10px; border-color: transparent; background: none; }
  .admin > .tabs button:hover:not(.on) { background: var(--card); color: var(--fg); }
  .admin > .tabs button.on { background: var(--accent); }
}

/* palier 3 (>= 1360) : formulaire de création épinglé à côté de sa liste */
@media (min-width: 1360px) {
  .gside { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
  .gside > form.card { position: sticky; top: 84px; margin-bottom: 0; }
  .gside .note:first-child { padding-top: 0; }
}

/* rapports */
.repfilters { margin: 4px 0 14px; }
.repfilters > summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); padding: 6px 0; }
.repfilters[open] > summary { margin-bottom: 8px; }
.savedrep { gap: 8px; }
.savedrep .btn { flex: 0 0 auto; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-align: left; }
.linkbtn:hover { text-decoration: underline; }
@media (min-width: 1180px) {
  .repgrid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
  .repgrid > div:first-child { position: sticky; top: 84px; }
}
@media (max-width: 420px) { nav button { font-size: 10px; min-width: 0; } }
.muted { color: var(--muted); }
.lg { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.lg > span { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tbl tr.grp td .lg { color: var(--accent); }
.lg.sub { padding-left: 14px; font-size: 13px; color: var(--fg) !important; }
.lg.total { padding: 12px 14px 4px; border-top: 2px solid var(--line); margin-top: 4px; font-size: 15px; }
.hero .amount.pos { color: var(--pos); }
.hero .amount.neg { color: var(--neg); }
@media (min-width: 1180px) {
  .duegrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
}
@media (max-width: 959px) { nav button { flex: 1 1 0; min-width: 0; padding-left: 0; padding-right: 0; } }
@media (max-width: 400px) { nav button { font-size: 9.5px; letter-spacing: -.01em; } }
.tbl tr.grp td .lg { text-transform: none; letter-spacing: 0; }
.duepick > summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.duepick[open] > summary { margin-bottom: 10px; }
.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 16px; }
.pickgrid .switch { color: var(--fg); font-size: 14px; }

/* fiche projet en onglets */
.phead { margin-bottom: 14px; }
.phead .crumb { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 14px; cursor: pointer; }
.phead .crumb:hover { text-decoration: underline; }
.phead h1 { font-size: 24px; margin: 6px 0 2px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phead h1 .sw { width: 12px; height: 12px; }
.ptabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.ptabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px; font: inherit; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.ptabs button:hover { color: var(--fg); }
.ptabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.ptool { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ptool > select { flex: 0 0 auto; width: auto; }
.ptool > input { flex: 1 1 220px; }
.ptadd { display: flex; gap: 8px; flex: 1 1 320px; }
.ptadd input { flex: 1; }
.ptadd .btn { flex: 0 0 auto; }
.cellin { width: 96px; min-height: 32px; height: 32px; padding: 4px 8px; font-size: 13px; display: inline-block; }
.rowbtns { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.kvrow { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kvrow:last-child { border-bottom: 0; }
.kvrow span { color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
.kvrow b { font-variant-numeric: tabular-nums; }
.psec { display: grid; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.psec:first-child { padding-top: 0; }
.psec h3 { margin: 0; font-size: 15px; }
.psec p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.psec input:not([type=checkbox]):not([type=radio]), .psec select { max-width: 520px; }
.linkbtn.pname { color: var(--fg); font-size: inherit; }
.linkbtn.pname:hover { color: var(--accent); }
.tablecard { overflow-x: auto; }
@media (min-width: 960px) {
  main { max-width: none; }
  .psec { grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
}
@media (min-width: 1180px) {
  .pstat { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; align-items: start; }
}
.pheadbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.unit { margin-left: 5px; color: var(--muted); }
.tbl td:has(> .cellin) { white-space: nowrap; }
@media (min-width: 960px) { .rowbtns { flex-wrap: nowrap; } }

/* aide (wiki) */
.helpbtn { font-weight: 700; min-width: 38px; }
.helpwrap { display: grid; gap: 18px; }
.helpnav input { margin-bottom: 10px; }
.helpnav a, .helpnav .hsec { display: none; }
.helpdoc { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 18px 28px; line-height: 1.6; font-size: 15px; min-width: 0; }
.helpdoc h1 { font-size: 26px; line-height: 1.25; margin: 4px 0 14px; }
.helpdoc h2 { font-size: 19px; margin: 30px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.helpdoc h3 { font-size: 16px; margin: 22px 0 6px; }
.helpdoc p { margin: 0 0 12px; }
.helpdoc ul, .helpdoc ol { margin: 0 0 12px; padding-left: 22px; }
.helpdoc li { margin: 4px 0; }
.helpdoc code { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 13px; }
.helpdoc a { color: var(--accent); }
.helpdoc figure { margin: 14px 0 20px; }
.helpdoc figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgba(20, 22, 26, .08); }
.helpdoc figure img[src*="mobile"], .helpdoc figure img[src*="saisie"] { max-width: 300px; }
.helpdoc figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.helpdoc .crumbs { font-size: 13px; color: var(--muted); }
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; font-size: 14px; }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.mdtable { overflow-x: auto; margin: 0 0 14px; }
.mdtable table { border-collapse: collapse; width: 100%; font-size: 14px; }
.mdtable th, .mdtable td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.mdtable th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.helptoc { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.helptoc b { width: 100%; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.helppager { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.helphit { padding: 12px 0; border-bottom: 1px solid var(--line); }
.helphit a { font-weight: 600; font-size: 16px; }
.helphit p { margin: 4px 0 0; font-size: 14px; }
@media (max-width: 959px) { nav button[data-view="help"] { display: none; } }
@media (min-width: 960px) {
  .helpbtn { display: none; }
  .helpwrap { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
  .helpnav { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
  .helpnav .helpsel { display: none; }
  .helpnav .hsec { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 8px 4px; }
  .helpnav a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--fg); text-decoration: none; font-size: 14px; }
  .helpnav a:hover { background: var(--card); }
  .helpnav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .helpdoc { padding: 30px 40px 40px; max-width: 980px; }
}
.ckscroll { max-height: 520px; overflow-y: auto; }
.cklog { font-size: 13px; color: var(--muted); max-height: 220px; overflow-y: auto; padding-left: 18px; }
.prog .f.done { background: var(--pos); }
.tag.done { background: var(--card); color: var(--pos); border: 1px solid var(--pos); }
.cellin.sm { width: 64px; }
.acctlink { cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.acctlink:hover { color: var(--accent); }

/* justificatifs */
.attach { display: flex; gap: 8px; flex-wrap: wrap; }
.attach label.btn { cursor: pointer; flex: 0 0 auto; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.fchips .attach label.btn { min-height: 28px; padding: 3px 10px; font-size: 12px; }
.fchip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; background: var(--card); max-width: 100%; }
.fchip a { color: var(--fg); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.fchip a:hover { color: var(--accent); }

/* activités PC */
.pctl { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 10px; margin-bottom: 14px; }
.pctl .bar { position: relative; height: 26px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.pctl .bar i { position: absolute; top: 0; bottom: 0; border-right: 1px solid var(--card); }
.pctl .ticks { position: relative; height: 18px; font-size: 11px; color: var(--muted); }
.pctl .ticks span { position: absolute; top: 3px; transform: translateX(-50%); }
.pctl .ticks span:first-child { transform: none; }
.pcact { display: flex; gap: 10px; align-items: flex-start; }
.pcact .s { font-size: 12px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-weight: 400; }
.appic { flex: 0 0 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; }
.pcsug { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pcsug .muted { font-size: 12px; }
.pcbulk { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; position: sticky; top: 76px; z-index: 5; box-shadow: 0 6px 20px rgba(20, 22, 26, .08); }
.pcbulk select { width: auto; max-width: 280px; min-height: 36px; }
.pcrule { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pcrule input { width: 180px; min-height: 32px; height: 32px; padding: 3px 8px; font-size: 13px; }
.pcsteps { font-size: 14px; padding-left: 20px; margin: 12px 0; }
.pcsteps li { margin: 4px 0; }
.cellin.kw { width: 150px; }
.toolbar input { min-height: 36px; }
@media (max-width: 959px) { nav button[data-view="pc"] { display: none; } }
@media (min-width: 1180px) { .pcgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; } }
.pcdate { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.pcdate .btn.icon { flex: 0 0 38px; min-height: 38px; font-size: 18px; }
.pcdate input { width: auto; min-height: 38px; }

/* activités PC : récapitulatif par projet et auto-tags */
.pcsums { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.pcsum { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.pcsum.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pcsum.unknown { border-style: dashed; }
.pcsum .t { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.pcsum .v { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.pcsum .v .pos { color: var(--pos); font-weight: 600; }
.pcsum .a { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.pcsum .a .btn { flex: 0 0 auto; }
.tagbtn { cursor: pointer; font: inherit; font-size: 11px; }
.tagbtn:hover { border-color: var(--accent); color: var(--accent); }
.pctagform { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; margin: 4px 0; }
.pctagform .field { margin-bottom: 8px; min-width: 170px; }
.pcrules .item .t, .pcrules .item .s { white-space: normal; }
.pcyes { display: flex; gap: 6px; }
.pchead-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.pcwhy { margin-top: 4px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; font-size: 12.5px; color: var(--fg); white-space: normal; }
.whybtn { font-size: 12px; font-weight: 600; }
.tbl tr.grp td .pctagform { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 14px; color: var(--fg); }

/* fiche projet : saisies d'une tâche */
.tasklink { color: var(--fg); font-size: inherit; font-weight: 600; }
.tasklink:hover { color: var(--accent); }
.tbl tr.notask td { background: var(--bg); }
.tentries { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 2px 0 6px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--fg); }
.tehead { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.tebar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tebar select { width: auto; min-height: 34px; max-width: 260px; }
.tetable { width: 100%; border-collapse: collapse; }
.tentries .tetable td { padding: 5px 8px; border-top: 1px solid var(--line); vertical-align: top; background: none; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 400; color: var(--fg); }
.tescroll { max-height: 420px; overflow: auto; }
.tetable td.num { text-align: right; }
.tetable tr.dim { opacity: .55; }
.nowrap { white-space: nowrap; }

/* fenêtre modale */
.modalbg { position: fixed; inset: 0; z-index: 40; background: rgba(10, 12, 16, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); color: var(--fg); border-radius: var(--r); padding: 20px; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.durchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.durchips button { border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.durchips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* journal de l'import Clockify */
.modal.wide { max-width: 820px; }
.cksum { font-size: 13px; margin: 4px 0 10px; }
/* import Clockify en cours : indicateur d'activité, barre animée, suivi projet par projet */
.spin { display: inline-block; width: 16px; height: 16px; flex: 0 0 auto; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); border-right-color: var(--accent); vertical-align: -3px; animation: spin .9s linear infinite; }
.spin.sm { width: 12px; height: 12px; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ckhead { display: flex; align-items: center; gap: 10px; }
.ckstep .spin { margin-right: 7px; }
.prog .t.live { position: relative; overflow: hidden; }
.prog .t.live::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); transform: translateX(-100%); animation: ckshine 1.6s ease-in-out infinite; }
@keyframes ckshine { to { transform: translateX(100%); } }
.ckjob { max-height: 420px; border: 1px solid var(--line); border-radius: 10px; }
.ckjob .tbl td { padding: 7px 10px; }
.ckjob .tbl th { position: sticky; top: 0; background: var(--card); padding-top: 10px; z-index: 1; }
.ckjob .chk { width: 22px; text-align: center; }
.ckjob td:nth-child(3) { white-space: nowrap; }
.ckjob tr.cklive td { background: var(--accent-soft); }
.ckst { font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  .spin { animation-duration: 2.4s; }
  .prog .t.live::after { animation: none; }
}
.logbox { max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.logline { display: flex; gap: 10px; padding: 6px 10px; border-top: 1px solid var(--line); align-items: baseline; }
.logline:first-child { border-top: 0; }
.logline .ti { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.logline .ic { width: 14px; text-align: center; flex: 0 0 14px; font-weight: 700; }
.logline.ok .ic { color: var(--pos); }
.logline.info .ic { color: var(--muted); }
.logline.warn { background: var(--warn-soft); }
.logline.warn .ic { color: var(--warn); }
.logline.error { background: color-mix(in srgb, var(--neg) 10%, transparent); }
.logline.error .ic, .logline.error span:last-child { color: var(--neg); }

/* compteur d'heures du header */
.hoursbadge { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; padding: 4px 12px; min-height: 38px; }
.hoursbadge span { white-space: nowrap; color: var(--muted); }
.hoursbadge b { color: var(--fg); font-weight: 650; }
.hbsub { display: none; }
.hbsub b { color: var(--fg); font-weight: 650; }
/* téléphone et tablette : le compteur prend la place du taux, sous le titre */
@media (max-width: 959px) { .hoursbadge, #top .rolepart { display: none; } .hbsub { display: inline; } }

/* --- To Do : listes à gauche, to-do au centre, détail à droite (superposé sous 1180 px) --- */
.tdi { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.tdi.i-sun { color: #c26b00; } .tdi.i-star { color: #c2185b; } .tdi.i-cal { color: #00838f; } .tdi.i-home { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tdi.i-sun { color: #f0b429; } :root:not([data-theme="light"]) .tdi.i-star { color: #f06292; } :root:not([data-theme="light"]) .tdi.i-cal { color: #4dd0e1; } }
:root[data-theme="dark"] .tdi.i-sun { color: #f0b429; } :root[data-theme="dark"] .tdi.i-star { color: #f06292; } :root[data-theme="dark"] .tdi.i-cal { color: #4dd0e1; }
.tdsearch { margin-bottom: 10px; }
.tdlist { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 14px; margin-bottom: 6px; background: var(--card); color: var(--fg);
  border: 1px solid var(--line); border-radius: 11px; font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.tdlist span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tdlist .sw { flex: 0 0 10px; margin: 0 4px; }
.tdlist b { font-size: 12px; font-weight: 600; color: var(--muted); }
.tdlist.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.tdlist.ghost { color: var(--accent); border-style: dashed; }
.tdlist .plus, .tdadd .plus { flex: 0 0 18px; font-size: 22px; line-height: 1; color: var(--accent); text-align: center; }
.tdsec { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin: 18px 4px 8px; }
.tdpick { margin-bottom: 6px; min-height: 44px; color: var(--muted); }
.tdnewlist { padding-right: 6px; }
.tdnewlist .btn { flex: 0 0 auto; }
.tdmail { margin-top: 18px; padding: 12px 4px 0; border-top: 1px solid var(--line); }
.tdmail .switch { color: var(--fg); font-size: 14px; }
.tdmail .note { padding-bottom: 0; }

.tdtitlebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tdh { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.tdh .tdi, .tdh .sw.big { width: 26px; height: 26px; flex: 0 0 26px; margin: 0; }
.tdh h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tdh .sub { font-size: 13px; color: var(--muted); }
.tdh .sub:first-letter { text-transform: uppercase; }
.tdtools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tdtools select { width: auto; min-height: 38px; padding: 6px 10px; font-size: 14px; }
.tdrename { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.tdrename .btn { flex: 0 0 auto; }
.tdback { display: none; }

.tdadd { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 0 14px; margin-bottom: 12px; }
.tdadd:focus-within { border-color: var(--accent); }
.tdadd input { border: 0; background: none; padding: 0; min-height: 52px; outline: none; }
.tdrow { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 9px 6px 9px 13px; margin-bottom: 6px; cursor: pointer; }
.tdrow:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tdrow.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tdrow.pending { border-style: dashed; }
.tdrow .main { flex: 1; min-width: 0; }
.tdrow .t { font-size: 15px; overflow-wrap: anywhere; }
.tdrow .s { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 6px; margin-top: 2px; font-size: 12px; color: var(--muted); }
.tdrow .s i { font-style: normal; opacity: .55; margin-left: 6px; }
.tdrow .s > span { display: inline-flex; align-items: center; white-space: nowrap; }
.tdrow .s > span.proj { display: inline; white-space: normal; }
.tdrow .s .tdi { width: 14px; height: 14px; flex-basis: 14px; margin-right: 3px; vertical-align: -2px; }
.tdrow .s .sw { width: 8px; height: 8px; margin-right: 5px; }
.tdrow.done .t { text-decoration: line-through; color: var(--muted); }
.tdlate { color: var(--neg) !important; font-weight: 600; }
.tdtoday { color: var(--accent); font-weight: 600; }
.tdgroup { font-size: 13px; font-weight: 650; color: var(--muted); margin: 16px 4px 6px; }
.tdcheck { flex: 0 0 22px; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid var(--muted); background: none; color: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tdcheck svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tdcheck:hover { color: var(--muted); border-color: var(--accent); }
.tdcheck.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.tdcheck.sm { flex-basis: 18px; width: 18px; height: 18px; }
.tdcheck.sm svg { width: 11px; height: 11px; }
.tdcheck.big { flex-basis: 26px; width: 26px; height: 26px; margin-top: 3px; }
.tdstar { flex: 0 0 auto; background: none; border: 0; padding: 8px; color: var(--muted); cursor: pointer; display: flex; }
.tdstar .tdi { width: 20px; height: 20px; flex-basis: 20px; color: inherit; }
.tdstar.on { color: #c2185b; }
.tdstar.on .tdi { fill: currentColor; }
.tdadd-day { flex: 0 0 auto; gap: 4px; padding: 0 10px; }
.tddone-toggle { background: none; border: 0; padding: 12px 4px 8px; font: inherit; font-size: 14px; font-weight: 650; color: var(--fg); cursor: pointer; }
.tdempty .tdi.big { display: block; width: 44px; height: 44px; margin: 0 auto 12px; }
.tdempty b { color: var(--fg); }
.tdsuggest { margin: 14px 0 4px; }
.tdsuggest > summary { cursor: pointer; font-size: 14px; font-weight: 650; padding: 6px 4px; }
.tdsuggest .note { padding: 0 4px 8px; }

.tddetail { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.tdhead { display: flex; align-items: flex-start; gap: 10px; }
.tdtitle { flex: 1; min-height: 0; padding: 2px 6px; border: 1px solid transparent; background: none; resize: none; font-size: 19px; font-weight: 650; line-height: 1.3; }
.tdtitle:hover { border-color: var(--line); }
.tdtitle.done { text-decoration: line-through; color: var(--muted); }
.tdhead .x { padding: 2px 6px; }
.tdsteps { margin: 8px 0 4px 36px; }
.tdstep { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.tdstep input { border: 0; background: none; min-height: 40px; padding: 4px 2px; font-size: 14px; }
.tdstep.d input { text-decoration: line-through; color: var(--muted); }
.tdstep .x { font-size: 16px; }
.tdstepadd { display: flex; align-items: center; gap: 10px; }
.tdstepadd .plus { flex: 0 0 18px; font-size: 20px; color: var(--accent); text-align: center; }
.tdstepadd input { border: 0; background: none; min-height: 42px; padding: 4px 2px; font-size: 14px; }
.tdbox { border: 1px solid var(--line); border-radius: 11px; margin-top: 12px; overflow: hidden; }
.tdline { display: flex; align-items: center; gap: 10px; padding: 8px 12px; width: 100%; }
.tdline + .tdline { border-top: 1px solid var(--line); }
.tdline.chipsline { border-top: 0; padding-top: 0; }
.tdline.chipsline .durchips { margin: 0 0 0 108px; }
.tdline label { flex: 0 0 98px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.tdline select, .tdline input { min-height: 40px; padding: 6px 10px; font-size: 14px; }
.tdline.note { font-size: 13px; padding-left: 120px; }
.tdline .btn { width: 100%; }
.tdline .btn .tdi { color: inherit; }
button.tdline { background: var(--card); border: 0; font: inherit; font-size: 14px; color: var(--muted); text-align: left; min-height: 46px; cursor: pointer; }
button.tdline span:first-of-type { flex: 1; }
button.tdline.on { color: var(--accent); font-weight: 600; }
.tdnote { margin-top: 12px; font-size: 14px; }
.tdfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--muted); }

/* téléphone et tablette : écran des listes, puis la liste ouverte ; détail en plein écran */
@media (max-width: 959px) {
  .td:not(.tdhome):not(.tdq) .tdside { display: none; }
  .td.tdhome:not(.tdq) .tdmain { display: none; }
  .td.tdq .tdside > :not(.tdsearch) { display: none; }
  .tdback { display: inline-flex; flex: 0 0 auto; }
  .tdtitlebar .tdh { flex-basis: 100%; order: 2; }
  .tdtitlebar .tdtools { order: 1; margin-left: auto; }
  .tdtools .btn { min-height: 34px; padding: 0 10px; }
}
@media (max-width: 1179px) {
  .tddetail { position: fixed; z-index: 45; inset: 0; border-radius: 0; border: 0; overflow: auto;
    padding: max(14px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
  .tdline label { flex-basis: 92px; }
}
@media (min-width: 960px) {
  .td { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
  .tdside { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding-bottom: 8px; }
  .tdlist { min-height: 42px; background: none; border-color: transparent; font-size: 14px; margin-bottom: 2px; }
  .tdlist:hover:not(.on) { background: var(--card); }
  .tdlist.ghost { border-color: transparent; }
  .tdmain { max-width: 900px; }
}
@media (min-width: 960px) and (max-width: 1179px) {
  .tddetail { left: auto; width: 440px; border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0, 0, 0, .18); }
}
@media (min-width: 1180px) {
  .td.tdsel { grid-template-columns: 240px minmax(0, 1fr) 380px; }
  .tddetail { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
}

/* barre du bas chargée (administrateur général : 9 boutons) */
@media (max-width: 959px) { nav.dense button { font-size: 9px; letter-spacing: -.02em; } }
@media (max-width: 380px) { nav.dense button { font-size: 8.5px; } }
@media (max-width: 340px) { nav.dense button { font-size: 8px; } }

/* --- To Do : to-do d'équipe des projets --- */
.tdi.i-user { color: #6d4cc2; }
:root[data-theme="dark"] .tdi.i-user { color: #b39dfa; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tdi.i-user { color: #b39dfa; } }
.tdbadge, .navbadge { font-style: normal; font-size: 11px; font-weight: 700; line-height: 1; min-width: 18px; padding: 3px 5px; border-radius: 999px;
  background: var(--neg); color: #fff; text-align: center; }
.tdlist .tdbadge { flex: 0 0 auto; }
nav button { position: relative; }
nav button .navbadge { position: absolute; top: 5px; left: calc(50% + 6px); }
@media (min-width: 960px) { nav button .navbadge { position: static; margin-left: auto; } }
.tdnewtag { background: var(--neg); color: #fff; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; vertical-align: 2px; }
.tdrow.fresh { border-color: color-mix(in srgb, var(--neg) 45%, var(--line)); }
.tdwho { font-weight: 600; color: var(--fg); }
.tdwho.free { color: var(--warn); }
.tdrow .s .tdwho .tdi { color: var(--muted); }
.tdcheck.ro { border-style: dashed; cursor: not-allowed; opacity: .55; }
.tdcheck.ro:hover { color: transparent; border-color: var(--muted); }
.tdcheck.on.ro { color: var(--accent-fg); }
.tdgroup .tdi { width: 15px; height: 15px; flex-basis: 15px; vertical-align: -3px; }
.tdteam { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); background: var(--accent-soft); border-radius: 9px; padding: 7px 10px; margin-bottom: 12px; }
.tdteam b { color: var(--fg); font-weight: 600; }
.tdval { flex: 1; font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 40px; }
.tdval .btn { width: auto; }
.tdtitle[readonly], .tdnote[readonly], .tdstep input[readonly] { cursor: default; }
.tdtitle[readonly]:hover { border-color: transparent; }
/* le titre garde au moins 220 px : sinon les choix passent à la ligne */
.tdaddteam { flex-wrap: wrap; column-gap: 12px; row-gap: 0; padding-bottom: 7px; padding-top: 0; }
.tdaddteam input[name="title"] { flex: 1 1 220px; min-width: 0; }
.tdaddopts { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 1 auto; }
.tdaddopts select, .tdaddopts input { width: auto; min-height: 38px; padding: 6px 10px; font-size: 14px; background: var(--bg); border: 1px solid var(--line); }
