/* DropWatch : clair ou sombre selon le système ; barre latérale sur ordinateur, onglets en bas sur téléphone */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #eef2f8;
  --text: #142033;
  --muted: #5b6b82;
  --line: #dbe2ec;
  --accent: #2459e6;
  --accent-2: #19b8ad;
  --accent-text: #ffffff;
  --ok: #138a52;
  --ok-bg: #e2f5ea;
  --pre: #2459e6;
  --pre-bg: #e3ebfd;
  --warn: #a35c00;
  --warn-bg: #fff1dc;
  --bad: #c22f2f;
  --bad-bg: #fde6e6;
  --idle: #6c7a90;
  --idle-bg: #edf0f5;
  --shadow: 0 1px 2px rgba(16, 32, 64, .06), 0 2px 8px rgba(16, 32, 64, .05);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1724;
    --panel: #172234;
    --panel-2: #1e2b40;
    --text: #e6edf7;
    --muted: #93a3bb;
    --line: #2a3a52;
    --accent: #5b8cff;
    --accent-2: #2fd3c6;
    --accent-text: #0b1220;
    --ok: #4fd38f;
    --ok-bg: #143628;
    --pre: #7fa6ff;
    --pre-bg: #1b2c52;
    --warn: #ffb54d;
    --warn-bg: #3a2a12;
    --bad: #ff7b7b;
    --bad-bg: #3d1a1d;
    --idle: #8d9ab0;
    --idle-bg: #222f44;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 4px; }
h2 { font-size: 1.02rem; margin: 22px 0 10px; }
h3 { font-size: .95rem; margin: 0; }
button, input, select { font: inherit; color: inherit; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }

/* mise en page */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; padding: 0 8px 18px; }
.brand img { width: 30px; height: 30px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); margin-bottom: 2px; }
.nav a:hover { background: var(--panel-2); text-decoration: none; }
.nav a.active { background: var(--pre-bg); color: var(--accent); font-weight: 600; }
.nav .count, .tabs .count { background: var(--bad); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 6px; margin-left: auto; }
.main { padding: 24px 28px 40px; max-width: 1180px; width: 100%; outline: none; }
.tabs { display: none; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.sub { color: var(--muted); font-size: .88rem; }
.split { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 20px; align-items: start; }
.split > .list-pane { position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow: auto; padding-right: 4px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); }
  .tabs { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
          background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: .66rem; color: var(--muted); position: relative; }
  .tabs a.active { color: var(--accent); font-weight: 600; }
  .tabs a:hover { text-decoration: none; }
  .tabs .ico { font-size: 1.2rem; line-height: 1; }
  .tabs .count { position: absolute; top: 4px; left: 55%; }
  .split { grid-template-columns: 1fr; }
  .split > .list-pane { position: static; max-height: none; overflow: visible; }
  .split.detail-open > .list-pane { display: none; }
  .split:not(.detail-open) > .detail-pane { display: none; }
  h1 { font-size: 1.2rem; }
}

/* blocs */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px; }
.card.link { display: block; color: inherit; cursor: pointer; }
.card.link:hover { border-color: var(--accent); text-decoration: none; }
.todo { border-left: 4px solid var(--pre); border-radius: 0 var(--radius) var(--radius) 0; }
.todo.group-now { border-left-color: var(--bad); }
.todo.group-soon { border-left-color: var(--warn); }
.todo h3 { margin: 0 0 2px; font-size: 1rem; }
.todo .sub { margin-bottom: 6px; }
.todo-actions { margin-top: 10px; }
details.more summary { margin: 0; padding: 4px 6px; font-size: .85rem; }
.more-body { display: none; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.todo:has(details.more[open]) .more-body { display: block; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; margin: 0 0 8px; font-size: .88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.steps { margin: 8px 0 0; padding-left: 20px; font-size: .9rem; }
.steps li { margin: 2px 0; }
.group-label { font-weight: 700; color: var(--muted); font-size: .85rem; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.plan summary { list-style: none; color: var(--text); }
.plan summary::-webkit-details-marker { display: none; }
.plan-lines { list-style: none; padding: 0; margin: 10px 0 8px; font-size: .9rem; }
.plan-lines li { padding: 3px 0; }
.plan-lines li.st-todo { color: var(--warn); font-weight: 600; }
.plan-lines li.st-no, .plan-lines li.st-wait { color: var(--muted); }
.due { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: .82rem; font-weight: 600; }
.due-now, .due-late { background: var(--bad-bg); color: var(--bad); }
.due-soon { background: var(--warn-bg); color: var(--warn); }
.due-later { background: var(--pre-bg); color: var(--pre); }
.releases { padding: 4px 16px; }
.release-row { color: inherit; padding: 10px 0; border-bottom: 1px solid var(--line); }
.release-row:last-child { border-bottom: none; }
.release-row:hover { text-decoration: none; }
.release-row:hover b { color: var(--accent); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 6px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.empty { color: var(--muted); padding: 10px 2px; }
.banner { border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.info { background: var(--pre-bg); color: var(--pre); }

/* pastilles */
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 9px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.pre { background: var(--pre-bg); color: var(--pre); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.idle { background: var(--idle-bg); color: var(--idle); }
.shops { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.shop { font-size: .74rem; border-radius: 7px; padding: 2px 7px; background: var(--idle-bg); color: var(--idle); border: 1px solid transparent; }
.shop.none { opacity: .55; }
.shop.in_stock { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.shop.unread { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.shop.preorder { background: var(--pre-bg); color: var(--pre); font-weight: 600; }

/* tableaux */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* boutons et formulaires */
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 7px 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: none; background: none; cursor: pointer; color: var(--muted); padding: 2px 6px; font-size: 1rem; }
input, select { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form input { flex: 1 1 140px; }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
label.field input { width: 100%; }

/* champs à copier */
.copy { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 1px 8px; cursor: pointer; }
.copy::after { content: "⧉"; color: var(--muted); font-size: .85em; }
.copy:hover { border-color: var(--accent); }

/* texte des messages et du rapport */
.rich { white-space: pre-wrap; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.timeline li:last-child { border-bottom: none; }
.timeline time { color: var(--muted); font-size: .8rem; }
.msg { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.countdown { font-weight: 700; }
.countdown.soon { color: var(--bad); }

/* connexion */
.login { max-width: 360px; margin: 12vh auto; }
.login .brand { justify-content: center; font-size: 1.4rem; }
.login .brand img { width: 44px; height: 44px; }
.error { color: var(--bad); font-size: .9rem; min-height: 1.3em; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
         background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: .9rem; transition: .2s; z-index: 10; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
@media (min-width: 861px) { .toast { bottom: 28px; } }
.spinner { color: var(--muted); padding: 30px 0; }
details summary { cursor: pointer; color: var(--muted); margin: 8px 0; }
.nowrap { white-space: nowrap; }
.offers .offer-row { padding: 9px 0; border-top: 1px solid var(--line); }
.offers .offer-row a { display: block; margin: 2px 0; overflow-wrap: anywhere; }
.wrong-panel { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
