@import url('/css/viewer.css');

:root {
  --bg: #f6f8fc;
  --text: #1f1f1f;
  --muted: #5e5e5e;
  --blue: #0b57d0;
  --nav-active: #d3e3fd;
  --compose: #c2e7ff;
  --row-read: #f2f6fc;
  --green: #188038;
  --red: #d93025;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 "Google Sans", Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; }
.ic { fill: currentColor; flex: none; }
[hidden] { display: none !important; }

/* ---------- Barre du haut ---------- */
.topbar { height: 64px; display: flex; align-items: center; gap: 8px; padding: 8px 16px 8px 12px; }
.icon-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; cursor: pointer; color: #444; flex: none; }
.icon-btn:hover { background: rgba(68,71,70,.08); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: #444; width: 190px; flex: none; }
.brand-name { font-size: 22px; letter-spacing: -.2px; color: #444; }
.search { flex: 1; max-width: 720px; height: 48px; background: #e9eef6; border-radius: 24px; display: flex; align-items: center; gap: 4px; padding: 0 16px 0 8px; transition: background .15s, box-shadow .15s; }
.search:focus-within { background: #fff; box-shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); }
.search-ic { width: 40px; display: grid; place-items: center; color: #444; }
.search input { flex: 1; border: 0; background: none; font: inherit; font-size: 16px; outline: none; min-width: 0; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.score-chip { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid #dadce0; border-radius: 18px; padding: 6px 14px; font-weight: 500; white-space: nowrap; }
.score-chip .ic { fill: #e37400; }
.lang-pick select { appearance: none; -webkit-appearance: none; background: #fff; border: 1px solid #dadce0; border-radius: 18px; padding: 6px 12px; font: inherit; font-weight: 500; color: inherit; cursor: pointer; }
.lang-pick select:hover { background: #f1f3f4; }
.lang-pick select:focus-visible { outline: 2px solid #1a73e8; outline-offset: 1px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.avatar-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; color: #fff; font-weight: 500; cursor: pointer; margin: 0 6px; }

/* ---------- Mise en page ---------- */
.layout { display: flex; height: calc(100vh - 64px); }
.sidebar { width: 256px; flex: none; padding: 8px 0 16px; overflow-y: auto; }
.compose { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 22px 0 16px; margin: 0 0 16px 8px; border: 0; border-radius: 16px; background: var(--compose); font-weight: 500; cursor: pointer; transition: box-shadow .15s; }
.compose:hover { box-shadow: 0 1px 3px rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15); }
.nav-item { display: flex; align-items: center; gap: 18px; width: calc(100% - 16px); height: 32px; padding: 0 12px 0 26px; border: 0; border-radius: 0 16px 16px 0; background: none; color: var(--text); text-decoration: none; cursor: pointer; text-align: left; }
.nav-item:hover { background: rgba(31,31,31,.07); }
.nav-item.active { background: var(--nav-active); font-weight: 700; }
.nav-ic { display: grid; place-items: center; color: #444; }
.nav-label { flex: 1; }
.nav-count { font-size: 12px; font-weight: 700; }
.progress-card { margin: 22px 16px 0 16px; padding: 14px 16px; background: #fff; border-radius: 12px; border: 1px solid #e3e7ee; }
.progress-card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.progress-bar { height: 8px; border-radius: 4px; background: #e8eaed; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, #1a73e8, #34a853); width: 0; transition: width .4s; }
.progress-card p { margin: 10px 0 6px; font-size: 13px; }
.link-btn { border: 0; background: none; color: var(--blue); padding: 0; cursor: pointer; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

.panel { flex: 1; background: #fff; border-radius: var(--radius); margin: 0 16px 16px 0; overflow: auto; min-width: 0; position: relative; }

/* ---------- Liste ---------- */
.list-toolbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 16px 0 8px; background: #fff; border-bottom: 1px solid #f1f3f4; }
.list-toolbar .grow { flex: 1; }
.list-toolbar .count { color: var(--muted); font-size: 12px; }
.small-btn { width: 40px; height: 40px; }
.tabs { display: flex; border-bottom: 1px solid #f1f3f4; }
.tab { display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 16px; min-width: 240px; color: var(--blue); border-bottom: 3px solid var(--blue); font-weight: 500; }
.tab .ic { fill: var(--blue); }
.intro-banner { display: flex; gap: 14px; align-items: center; margin: 12px 16px 6px; padding: 12px 16px; border-radius: 12px; background: #e8f0fe; color: #174ea6; font-size: 13.5px; }
.intro-banner b { color: #0b3d91; }
.intro-banner .ic { fill: #1a73e8; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 28px 28px 200px minmax(0,1fr) auto 24px 76px; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 10px; border-bottom: 1px solid #f1f3f4; cursor: pointer; background: #fff; position: relative; }
.row.read { background: var(--row-read); }
.row:hover { box-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); z-index: 1; }
.row .cb { width: 16px; height: 16px; border: 2px solid #757575; border-radius: 2px; justify-self: center; }
.row .star { border: 0; background: none; padding: 0; cursor: pointer; color: #757575; display: grid; place-items: center; }
.row .star.on { color: #f4b400; }
.row .sender, .row .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row:not(.read) .sender, .row:not(.read) .subj, .row:not(.read) .date { font-weight: 700; }
.row .subj { color: var(--text); }
.row .snip { color: var(--muted); }
.row .att { color: var(--muted); display: grid; place-items: center; }
.row .date { text-align: right; font-size: 12px; color: var(--text); }
.row.read .date { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 8px 1px 5px; border-radius: 10px; white-space: nowrap; }
.chip .ic { width: 14px; height: 14px; }
.chip.ok { background: #e6f4ea; color: var(--green); }
.chip.ko { background: #fce8e6; color: var(--red); }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }

/* ---------- Lecture ---------- */
.read-toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 12px 0 8px; background: #fff; border-bottom: 1px solid #f1f3f4; }
.read-toolbar .grow { flex: 1; }
.read-toolbar .pos { font-size: 12px; color: var(--muted); padding: 0 6px; }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.read-wrap { padding: 16px 24px 48px 16px; max-width: 1100px; }

.quiz { margin: 0 0 20px 56px; border-radius: 12px; padding: 16px 18px; border: 1px solid #c6dafc; background: linear-gradient(180deg, #f3f7fe, #fff); }
.quiz h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.quiz p.hint { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.answer-btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: 21px; border: 1px solid; background: #fff; font-weight: 600; cursor: pointer; font-size: 14.5px; transition: background .15s, transform .05s; }
.answer-btn:active { transform: scale(.98); }
.answer-btn.legit { color: var(--green); border-color: #a8dab5; }
.answer-btn.legit:hover { background: #e6f4ea; }
.answer-btn.phish { color: var(--red); border-color: #f6aea9; }
.answer-btn.phish:hover { background: #fce8e6; }
.quiz.result.good { border-color: #a8dab5; background: linear-gradient(180deg, #e6f4ea, #fff 70%); }
.quiz.result.bad { border-color: #f6aea9; background: linear-gradient(180deg, #fce8e6, #fff 70%); }
.result-head { display: flex; align-items: center; gap: 10px; }
.result-head .big { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.good .big { background: var(--green); } .bad .big { background: var(--red); }
.result-head h3 { margin: 0; }
.verdict-tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-left: 4px; vertical-align: 2px; }
.verdict-tag.phishing { background: var(--red); color: #fff; } .verdict-tag.legit { background: var(--green); color: #fff; }
.explanation { margin: 12px 0 10px; font-size: 14.5px; line-height: 1.6; }
.clues-title { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
.clues { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.clues li.clickable { cursor: pointer; border-radius: 8px; margin: -4px -6px; padding: 4px 6px; }
.clues li.clickable:hover { background: rgba(0,0,0,.04); }
.clues li { display: grid; grid-template-columns: 26px 1fr; gap: 6px; font-size: 14px; }
.clues li .hm-badge { margin: 1px 0 0; }
.clues b { display: block; }
.clues span.d { color: #3c4043; }
.next-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.primary-btn { height: 40px; padding: 0 22px; border-radius: 20px; border: 0; background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.primary-btn:hover { background: #0a4cb8; box-shadow: 0 1px 3px rgba(60,64,67,.3); }
.ghost-btn { height: 40px; padding: 0 18px; border-radius: 20px; border: 1px solid #c4c7c5; background: #fff; color: var(--blue); font-weight: 600; cursor: pointer; }
.ghost-btn:hover { background: #f3f6fc; }

/* ---------- Barre d'état des liens (comme un navigateur) ---------- */
.statusbar { position: fixed; left: 0; bottom: 0; max-width: 70vw; background: #f1f3f4; border: 1px solid #c4c7c5; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; padding: 3px 10px; font-size: 12.5px; color: #202124; z-index: 50; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: Arial, sans-serif; }
.statusbar b { color: #000; }

.toast { position: fixed; left: 24px; bottom: 28px; background: #303030; color: #f2f2f2; padding: 14px 20px; border-radius: 6px; box-shadow: 0 3px 8px rgba(0,0,0,.3); z-index: 60; max-width: min(560px, calc(100vw - 48px)); font-size: 14px; line-height: 1.5; }
.toast b { color: #fff; }
.toast .dom { color: #fdd663; font-weight: 700; }

/* ---------- Fenêtres ---------- */
.modal { border: 0; border-radius: 24px; padding: 0; max-width: min(620px, calc(100vw - 24px)); width: 100%; box-shadow: 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12); }
.modal::backdrop { background: rgba(32,33,36,.55); }
.modal-body { padding: 28px 30px 24px; max-height: 85vh; overflow: auto; }
.modal h2 { margin: 0 0 12px; font-size: 22px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.modal .lead { font-size: 15px; line-height: 1.6; }
.lang-lead { display: flex; flex-direction: column; gap: 2px; color: #3c4043; }
.lang-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 6px; }
.lang-choice { height: 56px; border-radius: 16px; border: 1px solid #c4c7c5; background: #fff; color: #1f1f1f; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.lang-choice:hover { background: #f3f6fc; border-color: var(--blue); }
.lang-choice:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.lang-choice.suggested { border-color: var(--blue); background: #e8f0fe; color: #0b57d0; }
@media (max-width: 520px) { .lang-choices { grid-template-columns: 1fr; } }
.modal pre.context { white-space: pre-wrap; font: inherit; background: #f6f8fc; border-radius: 12px; padding: 14px 16px; line-height: 1.6; margin: 12px 0; }
.modal ol, .modal ul { padding-left: 20px; line-height: 1.6; }
.modal li { margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.score-big { font-size: 46px; font-weight: 700; margin: 6px 0; color: var(--blue); }
.persona { display: flex; align-items: center; gap: 12px; margin: 6px 0 4px; }
.persona .avatar-btn { display: grid; place-items: center; width: 44px; height: 44px; font-size: 18px; margin: 0; cursor: default; }

/* ---------- Mobile ---------- */
@media (max-width: 1000px) {
  .row { grid-template-columns: 28px 160px minmax(0,1fr) auto 70px; }
  .row .cb, .row .att { display: none; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .brand { width: auto; } .brand-name { display: none; }
  .score-chip span.lbl { display: none; }
  .search { min-width: 0; height: 44px; }
  .topbar { gap: 4px; padding: 8px; }
  #helpBtn { display: none; }
  .score-chip { padding: 5px 10px; }
  .avatar-btn { margin: 0 2px; }
  .layout { height: auto; min-height: calc(100vh - 64px); }
  .sidebar { position: fixed; top: 64px; left: 0; bottom: 0; background: var(--bg); z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 2px 0 12px rgba(0,0,0,.15); }
  body.nav-open .sidebar { transform: none; }
  .panel { margin: 0 8px 8px; }
  .row { grid-template-columns: 1fr auto; grid-template-rows: auto auto; height: auto; padding: 10px 14px; gap: 2px 8px; }
  .row .star, .row .cb, .row .att { display: none; }
  .row .sender { grid-column: 1; } .row .date { grid-column: 2; grid-row: 1; }
  .row .line { grid-column: 1 / -1; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .row .res { grid-column: 2; grid-row: 1; justify-self: end; margin-right: 56px; }
  .tab { min-width: 0; }
  .read-wrap { padding: 12px 14px 40px; }
  .quiz { margin-left: 0; }
  .statusbar { max-width: 100vw; }
}
body.nav-mini .sidebar { display: none; }
body.nav-mini .panel { margin-left: 16px; }
