/* ── ESO TODO — STYLES ── */
:root {
  --bg: #0d1535; --surface: #141d3d; --surface2: #1a2548;
  --border: #243060; --accent: #FFD04F; --accent2: #2E6BC4;
  --text: #e8eaf6; --muted: #6b7ab8;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --red:#ef4444; --orange:#f97316; --yellow:#eab308; --gray:#475569; --green:#22c55e;
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent }
html { height:100% }
body { background:var(--bg); color:var(--text); font-family:-apple-system,'Syne',system-ui,sans-serif; min-height:100vh; padding-top:calc(var(--safe-top)) }
.app-wrap { max-width:1100px; margin:0 auto; position:relative }
input,textarea,select { font-size:16px !important }

/* ── HEADER ── */
.hdr { display:flex; align-items:center; justify-content:space-between; padding:calc(var(--safe-top) + 14px) 16px 14px; background:var(--surface); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:100 }
.hdr-left { display:flex; align-items:center; gap:10px }
.hdr-icon { width:32px; height:32px; background:var(--accent); border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:18px }
.hdr-title { font-family:'Syne',sans-serif; font-size:20px; font-weight:800; letter-spacing:-0.5px }
.hdr-title span { color:var(--accent) }
.hdr-right { display:flex; gap:8px; align-items:center }
.dot { width:8px; height:8px; border-radius:50%; background:var(--red); display:inline-block; transition:background .3s }
.dot.on { background:var(--green) }
.icon-btn { background:var(--surface2); border:1px solid var(--border); border-radius:8px; color:var(--muted); font-size:15px; padding:7px 10px; cursor:pointer; text-decoration:none; touch-action:manipulation }

/* ── KPI ── */
.kpi { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; padding:12px 16px; background:var(--surface); border-bottom:1px solid var(--border) }
.kpi-item { background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:8px 6px; text-align:center }
.kpi-n { font-family:'Space Mono',monospace; font-size:20px; font-weight:700; line-height:1 }
.kpi-l { font-size:9px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-top:3px }

/* ── CAPTURE ── */
.capture { padding:12px 16px; background:var(--surface); border-bottom:1px solid var(--border) }
.cap-row { display:flex; gap:8px; align-items:stretch }
.mic-btn { flex-shrink:0; width:52px; height:52px; background:var(--surface2); border:2px solid var(--border); border-radius:12px; font-size:24px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all .15s; touch-action:manipulation; -webkit-user-select:none; user-select:none }
.mic-btn.rec { background:rgba(239,68,68,.15); border-color:var(--red); animation:pulse 1s ease-in-out infinite }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }
.cap-input { flex:1; background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:10px 12px; color:var(--text); outline:none; transition:border-color .15s }
.cap-input:focus { border-color:var(--accent2) }
.cap-input::placeholder { color:var(--muted) }
.add-btn { flex-shrink:0; background:var(--accent); border:none; border-radius:10px; padding:10px 14px; font-size:13px; font-weight:800; color:#0d1535; cursor:pointer; touch-action:manipulation; font-family:'Syne',sans-serif }
.add-btn:disabled { opacity:.5 }
.cat-row { display:flex; gap:6px; margin-top:8px; overflow-x:auto; padding-bottom:2px; -webkit-overflow-scrolling:touch }
.cat-chip { flex-shrink:0; background:var(--surface2); border:1px solid var(--border); border-radius:20px; padding:4px 10px; font-size:12px; font-weight:700; color:var(--muted); cursor:pointer; touch-action:manipulation; white-space:nowrap }
.cat-chip.sel { background:var(--accent2); border-color:var(--accent2); color:#fff }
.cap-hint { font-size:11px; color:var(--muted); margin-top:6px; line-height:1.5 }
.cap-hint strong { color:var(--accent) }

/* ── TOOLBAR ── */
.toolbar { display:flex; gap:6px; align-items:center; padding:10px 16px; border-bottom:1px solid var(--border); background:var(--surface) }
.tab-btn { background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:7px 12px; font-size:12px; font-weight:700; color:var(--muted); cursor:pointer; touch-action:manipulation }
.tab-btn.active { background:var(--accent2); border-color:var(--accent2); color:#fff }
.reorg-btn { margin-left:auto; background:rgba(255,208,79,.1); border:1px solid rgba(255,208,79,.3); border-radius:8px; padding:7px 12px; font-size:12px; font-weight:700; color:var(--accent); cursor:pointer; touch-action:manipulation; display:flex; align-items:center; gap:5px }
.reorg-btn:disabled { opacity:.5 }
.spin-icon { display:none }
.reorg-btn.loading .spin-icon { display:inline; animation:rotate .8s linear infinite }
@keyframes rotate { to{transform:rotate(360deg)} }

/* ── FILTER ROW ── */
.filter-row { display:flex; gap:6px; padding:8px 16px; background:var(--surface); border-bottom:1px solid var(--border); overflow-x:auto; -webkit-overflow-scrolling:touch }

/* ── LISTE ── */
.list { padding:12px 16px; padding-bottom:calc(80px + var(--safe-bot)); max-width:100%; margin:0 auto; width:100% }
.todo-card { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:14px; margin-bottom:8px; border-left:3px solid var(--gray); transition:opacity .2s }
.todo-card.done { opacity:.45 }
.todo-card[data-u="URGENT"] { border-left-color:var(--red) }
.todo-card[data-u="HAUTE"]  { border-left-color:var(--orange) }
.todo-card[data-u="NORMALE"]{ border-left-color:var(--yellow) }
.todo-card[data-u="FAIBLE"] { border-left-color:var(--gray) }
.card-top { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; margin-bottom:6px }
.badges { display:flex; gap:4px; flex-wrap:wrap }
.ubadge { font-size:10px; font-weight:700; padding:2px 7px; border-radius:20px; letter-spacing:.04em }
.u-URGENT { background:rgba(239,68,68,.15); color:var(--red);    border:1px solid rgba(239,68,68,.3) }
.u-HAUTE  { background:rgba(249,115,22,.15); color:var(--orange); border:1px solid rgba(249,115,22,.3) }
.u-NORMALE{ background:rgba(234,179,8,.15);  color:var(--yellow); border:1px solid rgba(234,179,8,.3) }
.u-FAIBLE { background:rgba(71,85,105,.15);  color:var(--gray);   border:1px solid rgba(71,85,105,.3) }
.cbadge { font-size:10px; font-weight:700; padding:2px 7px; border-radius:20px; background:var(--surface2); border:1px solid var(--border); color:var(--muted) }
.card-date  { font-size:10px; color:var(--muted); flex-shrink:0 }
.card-title { font-size:15px; font-weight:700; color:var(--text); line-height:1.4; margin-bottom:4px }
.card-title.done { text-decoration:line-through; color:var(--muted) }
.card-raison{ font-size:12px; color:var(--muted); font-style:italic; margin-bottom:8px; line-height:1.5 }
.card-notes { font-size:12px; color:var(--text); background:var(--surface2); border-radius:8px; padding:6px 8px; margin-bottom:8px; line-height:1.5; border:1px solid var(--border) }
.card-actions { display:flex; gap:6px; align-items:center; flex-wrap:wrap; margin-top:8px }
.abtn { border:none; border-radius:8px; padding:6px 10px; font-size:12px; font-weight:700; cursor:pointer; touch-action:manipulation }
.abtn-check { background:rgba(34,197,94,.12); color:var(--green);  border:1px solid rgba(34,197,94,.25) }
.abtn-sec   { background:var(--surface2);      color:var(--muted);  border:1px solid var(--border) }
.abtn-del   { background:rgba(239,68,68,.1);   color:var(--red);    border:1px solid rgba(239,68,68,.25) }
.usel { background:var(--surface2); border:1px solid var(--border); border-radius:8px; color:var(--muted); font-size:11px; padding:5px 6px; cursor:pointer; margin-left:auto }

/* ── NOTE PANEL ── */
.note-panel { margin-top:8px; display:flex; flex-direction:column; gap:6px }
.note-panel.hidden { display:none }
.note-ta { background:var(--surface2); border:1px solid var(--border); border-radius:8px; color:var(--text); padding:8px 10px; min-height:60px; resize:vertical; width:100%; line-height:1.5 }
.note-label { font-size:11px; color:var(--muted); font-weight:700; text-transform:uppercase; letter-spacing:.05em }

/* ── EMPTY ── */
.empty { text-align:center; padding:60px 20px; color:var(--muted) }
.empty .emoji { font-size:48px; margin-bottom:16px }
.empty .title { font-size:16px; font-weight:700; margin-bottom:8px; color:var(--text) }
.empty .sub   { font-size:13px }

/* ── TOAST ── */
#toast { position:fixed; bottom:calc(20px + var(--safe-bot)); left:50%; transform:translateX(-50%); background:var(--surface2); border:1px solid var(--border); border-radius:12px; padding:10px 20px; font-size:13px; font-weight:700; color:var(--text); z-index:9999; opacity:0; transition:opacity .2s; pointer-events:none; white-space:nowrap; max-width:calc(100vw - 32px) }
#toast.show { opacity:1 }

/* ── CONFIG OVERLAY ── */
#cfg-ov { display:none; position:fixed; inset:0; background:rgba(0,0,0,.7); z-index:500; align-items:flex-end; justify-content:center }
#cfg-ov.open { display:flex }
#cfg-panel { background:var(--surface); border-radius:20px 20px 0 0; padding:24px 20px calc(24px + var(--safe-bot)); width:100%; max-width:500px }
.cfg-ttl { font-size:16px; font-weight:800; margin-bottom:16px; display:flex; justify-content:space-between; align-items:center }
.cfg-x   { background:none; border:none; font-size:22px; cursor:pointer; color:var(--muted) }
.cfg-lbl { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); display:block; margin-bottom:5px }
.cfg-row { display:flex; gap:6px; align-items:center; margin-bottom:12px }
.cfg-f   { flex:1; background:var(--surface2); border:1px solid var(--border); border-radius:8px; color:var(--text); padding:9px 12px; font-family:monospace; letter-spacing:1px }
.cfg-eye { background:none; border:1px solid var(--border); border-radius:6px; padding:7px 9px; cursor:pointer; color:var(--muted); font-size:14px }
.cfg-save{ width:100%; background:var(--accent); border:none; border-radius:12px; padding:14px; font-size:15px; font-weight:800; color:#0d1535; cursor:pointer; font-family:'Syne',sans-serif; margin-top:4px }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width:4px }
::-webkit-scrollbar-track { background:transparent }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:4px }
