/* home.css — Tableau de bord d'Arthur */
:root {
  --bg: #f6f5f2; --card: #ffffff; --ink: #1d1d1f; --muted: #6e6e73; --line: #e7e5e0;
  --accent: #2f5bea; --accent-soft: #e8eefd; --warn: #c2410c; --warn-soft: #fff1e8; --ok: #15803d;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171a; --card: #1f2024; --ink: #ececee; --muted: #9a9aa2; --line: #2e2f35;
    --accent: #7c9bff; --accent-soft: #252c44; --warn: #fb923c; --warn-soft: #3a2a1f; --ok: #4ade80;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; resize: vertical; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 500; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 2px 4px; font-size: 13px; font-weight: 500; }
.mini { padding: 3px 6px; font-size: 12.5px; border-radius: 8px; }

/* connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--card); padding: 32px; border-radius: 18px; box-shadow: var(--shadow); width: min(360px, 100%); display: grid; gap: 12px; text-align: center; }
.login-card h1 { font-family: Fraunces, Georgia, serif; font-weight: 600; margin: 4px 0 0; }
.login-card p { margin: 0 0 6px; color: var(--muted); }
.login-mark { width: 48px; height: 48px; margin: 0 auto; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 22px; }
.err { color: var(--warn); font-size: 13px; min-height: 18px; }

/* structure */
.app { max-width: 1240px; margin: 0 auto; padding: 28px 24px 40px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; flex-wrap: wrap; }
.date { color: var(--muted); font-size: 13px; text-transform: capitalize; }
.hello h1 { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: 34px; margin: 2px 0 0; letter-spacing: -.01em; }
.capture { display: flex; gap: 8px; flex: 1; max-width: 640px; min-width: 280px; }
.capture input[type=text] { flex: 1; min-width: 0; }

.grid { display: grid; gap: 16px; align-items: start; grid-template-columns: repeat(12, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-h h2 { font-size: 14px; font-weight: 600; margin: 0; letter-spacing: .01em; }
.card-tools { display: flex; gap: 6px; align-items: center; }
.hint { margin: -4px 0 8px; font-size: 12.5px; color: var(--muted); }
.c-agenda { grid-column: span 4; } .c-tasks { grid-column: span 5; } .c-deadlines { grid-column: span 3; }
.c-news { grid-column: span 8; } .c-projects { grid-column: span 4; }
.c-inbox { grid-column: span 4; } .c-links { grid-column: span 4; } .c-review { grid-column: span 4; }
@media (max-width: 1000px) {
  .c-agenda, .c-tasks, .c-deadlines, .c-news, .c-projects, .c-inbox, .c-links, .c-review { grid-column: span 6; }
  .c-news { grid-column: span 12; }
}
@media (max-width: 680px) {
  .app { padding: 18px 16px 32px; }
  .grid > .card { grid-column: span 12; }
  .hello h1 { font-size: 28px; }
  .capture { flex-wrap: wrap; } .capture select { flex: 0 0 auto; }
  /* sur téléphone : l'essentiel d'abord */
  .c-tasks { order: 1; } .c-agenda { order: 2; } .c-deadlines { order: 3; } .c-news { order: 4; }
  .c-projects { order: 5; } .c-inbox { order: 6; } .c-links { order: 7; } .c-review { order: 8; }
}

/* listes */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .t { flex: 1; min-width: 0; word-wrap: break-word; cursor: text; }
.list .t small { display: block; color: var(--muted); font-size: 12px; }
.list li.done .t { text-decoration: line-through; color: var(--muted); }
.list li.top { background: linear-gradient(90deg, var(--accent-soft), transparent 80%); margin: 0 -8px; padding: 7px 8px; border-radius: 8px; border-top-color: transparent; }
.list .sep { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-top: 12px; border-top: 0; }
.chk { appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--muted); border-radius: 6px; margin: 2px 0 0; padding: 0; cursor: pointer; flex: none; display: grid; place-items: center; }
.chk:checked { background: var(--ok); border-color: var(--ok); }
.chk:checked::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 700; }
.ico-btn { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; font-size: 14px; line-height: 1.4; opacity: .55; }
.ico-btn:hover { opacity: 1; }
.ico-btn.on { color: #e5a400; opacity: 1; }
.list li .acts { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.list li:hover .acts, .list li:focus-within .acts { opacity: 1; }
@media (hover: none) { .list li .acts { opacity: 1; } }
.empty { color: var(--muted); font-size: 13.5px; padding: 6px 0; }

/* échéances */
.due { flex: none; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.due.soon { background: var(--warn-soft); color: var(--warn); }
.due.late { background: var(--warn); color: #fff; }

/* agenda */
.agenda .day { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 4px; }
.agenda .day:first-child { margin-top: 0; }
.ev { display: grid; grid-template-columns: 54px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.ev .h { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.ev .l { color: var(--muted); font-size: 12px; }
.ev.now { background: var(--accent-soft); margin: 0 -8px; padding: 6px 8px; border-radius: 8px; }
.ev.past { opacity: .5; }
.setup { font-size: 13.5px; color: var(--muted); }
.setup p { margin: 0 0 10px; }

/* briefing */
.news h3 { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 6px; font-weight: 600; }
.news h3:first-child { margin-top: 2px; }
.nitem { padding: 8px 0; border-top: 1px solid var(--line); }
.nitem:first-of-type { border-top: 0; }
.nitem .nt { font-weight: 600; cursor: pointer; }
.nitem .nr { display: none; }
.nitem.open .nr { display: block; }
.nitem .nt::after { content: " ▾"; color: var(--muted); font-size: 11px; font-weight: 400; }
.nitem.open .nt::after { content: " ▴"; }
.nitem .nr { margin: 2px 0; }
.nitem .np { color: var(--muted); font-size: 13px; }
.nitem .np b { color: var(--ink); font-weight: 500; }
.nitem .ns { font-size: 12px; }
.sujet { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; margin-top: 4px; }
.sujet > div:nth-child(2) { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sujet.open > div:nth-child(2) { display: block; }
.sujet .nt { cursor: pointer; font-family: Fraunces, Georgia, serif; font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.news.folded { max-height: 120px; overflow: hidden; position: relative; }
.news.folded::after { content: ""; position: absolute; inset: auto 0 0 0; height: 60px; background: linear-gradient(transparent, var(--card)); }
.news-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
@media (max-width: 760px) { .news-cols { grid-template-columns: 1fr; } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* projets */
.projects { display: grid; gap: 8px; }
.proj { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; cursor: pointer; }
.proj:hover { border-color: var(--accent); }
.proj .pt { font-weight: 600; font-size: 14px; }
.proj .pn { color: var(--muted); font-size: 13px; }
.proj .pn::before { content: "→ "; color: var(--accent); }

/* lanceur */
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line); text-align: center; font-size: 12.5px; color: var(--ink); line-height: 1.25; position: relative; }
.tile:hover { border-color: var(--accent); text-decoration: none; background: var(--accent-soft); }
.tile .e { font-size: 22px; }
.links.editing .tile { cursor: pointer; border-style: dashed; }
.tile .x { position: absolute; top: 2px; right: 4px; font-size: 12px; color: var(--warn); }

/* revue */
.c-review label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.c-review textarea { margin-top: 4px; font-size: 13.5px; }
.c-review.sunday { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.foot { display: flex; justify-content: space-between; margin-top: 22px; font-size: 13px; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); padding: 20px; width: min(440px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h3 { margin: 0 0 12px; font-size: 16px; }
#dlgBody { display: grid; gap: 10px; }
#dlgBody label { display: grid; gap: 4px; font-size: 13px; font-weight: 500; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 13.5px; opacity: 0; transition: .2s; pointer-events: none; z-index: 10; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------- Jarvis ---------- */
.jarvis { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px 12px; margin-bottom: 16px; position: relative; overflow: hidden; }
.jarvis::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), #22b8cf, var(--accent)); opacity: .8; }
.j-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.j-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; letter-spacing: .02em; }
.j-dot { width: 9px; height: 9px; border-radius: 50%; background: #22b8cf; box-shadow: 0 0 0 4px rgba(34,184,207,.18); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(34,184,207,.05); } }
.sys { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; cursor: pointer; }
.sys-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px 1px 6px; white-space: nowrap; }
.sys-pill i { width: 7px; height: 7px; border-radius: 50%; background: #a1a1aa; }
.sys-pill.ok i { background: var(--ok); } .sys-pill.ko i { background: #dc2626; } .sys-pill.ko { color: #dc2626; border-color: #fca5a5; }
.sys-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 10px; }
.sys-table td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.j-thread { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; padding: 4px 2px; }
.j-msg { max-width: 88%; padding: 9px 13px; border-radius: 12px; font-size: 14.5px; }
.j-msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.j-msg.ai { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.j-msg.ai p { margin: 0 0 6px; } .j-msg.ai p:last-child { margin-bottom: 0; }
.j-msg.ai ul { margin: 2px 0 8px; padding-left: 20px; } .j-msg.ai li { margin: 2px 0; }
.j-act { font-size: 13px; color: var(--ok); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.j-act .link-btn:disabled { color: var(--muted); cursor: default; }
.j-src { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.j-src a, .j-src span { color: var(--muted); } .j-src a { text-decoration: underline; }
.j-form { display: flex; gap: 8px; align-items: flex-end; }
.j-form textarea { flex: 1; resize: none; min-height: 42px; line-height: 1.45; }
.j-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.j-chips button { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.j-chips button:hover { border-color: var(--accent); color: var(--accent); }
.j-chips .ghost { background: none; color: var(--muted); }
#jDlg { width: min(560px, calc(100% - 32px)); }
.log { list-style: none; padding: 0; margin: 0; max-height: 60vh; overflow-y: auto; font-size: 13.5px; }
.log li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); }
.log .when { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.log .what { flex: 1; }
.log li.undone .what { text-decoration: line-through; color: var(--muted); }
@media (max-width: 680px) { .j-msg { max-width: 96%; } .sys { order: 3; flex-basis: 100%; } }

/* bandeau du QG */
.qg-band { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 24px; align-items: center; background: #111318; color: #f5f3ee; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; position: relative; overflow: hidden; text-decoration: none !important; }
.qg-band::after { content: ""; position: absolute; right: -80px; top: -120px; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,90,31,.3), transparent); pointer-events: none; }
.qg-band:hover { outline: 2px solid #ff5a1f; }
.qg-eye { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #ff5a1f; font-weight: 600; }
.qg-cap b { font-family: Fraunces, Georgia, serif; font-size: 21px; line-height: 1.2; font-weight: 600; }
.qg-nums { display: flex; gap: 20px; position: relative; z-index: 1; }
.qg-nums div { display: flex; flex-direction: column; align-items: flex-start; max-width: 170px; }
.qg-nums b { font-family: Fraunces, Georgia, serif; font-size: 26px; color: #ff5a1f; line-height: 1; }
.qg-nums span { font-size: 11.5px; color: #a1a1aa; }
.qg-promise { grid-column: 1; font-size: 13px; color: #d4d4d8; }
.qg-promise:empty { display: none; }
.qg-go { grid-column: 2; justify-self: end; font-size: 12.5px; color: #a1a1aa; position: relative; z-index: 1; }
@media (max-width: 760px) { .qg-band { grid-template-columns: 1fr; } .qg-go { grid-column: 1; justify-self: start; } }
