:root {
  --text: #121212;
  --muted: #6b6b6b;
  --soft: #8a8a8a;
  --line: #ececec;
  --bg: #ffffff;
  --field: #f2f2f2;
  --green: #2e8b2e;
  --ai: #6a4cff;
  --ai-soft: #f1eeff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: "Poppins", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img { display: block; }

.container { max-width: 1440px; margin: 0 auto; padding: 0 78px; }

/* ---------- Header ---------- */
.header { position: sticky; top: 0; z-index: 10; background: #fff; box-shadow: 0 6px 12px -10px rgba(0,0,0,.12); }

.topbar {
  display: flex;
  align-items: center;
  gap: 100px;
  height: 92px;
}

.logo { font-size: 25px; font-weight: 700; letter-spacing: .2px; flex-shrink: 0; }

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 18px;
  background: var(--field);
  border-radius: 999px;
}
.search svg { flex-shrink: 0; color: var(--muted); }
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  outline: none;
  color: var(--text);
}
.search input::placeholder { color: #8f8f8f; }

.actions { display: flex; align-items: center; gap: 28px; margin-left: -18px; }
.icon-btn { display: grid; place-items: center; width: 24px; height: 24px; color: #3a3a3a; }

.tabs {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  padding: 10px 15px 12px;
  margin-right: 17px;
  font-size: 15px;
  color: var(--muted);
}
.tab.active { color: var(--text); font-weight: 600; }
.tab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--text);
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 427px;
  gap: 35px;
  padding-top: 34px;
  padding-bottom: 60px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 118px;
  padding: 18px 21px;
  border-radius: 12px;
  overflow: hidden;
  background: #050505;
  color: #fff;
}
.hero svg.marble { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero h1 {
  position: relative;
  font-size: 25px;
  font-weight: 600;
  line-height: 1.52;
}
.hero .btn {
  position: relative;
  padding: 11px 31px;
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- Articles ---------- */
.article {
  display: flex;
  gap: 40px;
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}
.article:last-child { border-bottom: 0; }
.article-body { flex: 1; min-width: 0; }
.category { font-size: 13px; color: var(--muted); }
.article h2 {
  margin: 6px 0 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
}
.article h2 a:hover { text-decoration: underline; }
.excerpt {
  font-size: 15px;
  line-height: 1.5;
  color: #8a8a8a;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  row-gap: 4px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.meta .dot { width: 4px; height: 4px; border-radius: 50%; background: #c9c9c9; margin: 0 8px; }
.meta .source { font-weight: 500; color: #3a3a3a; }
.meta .lang {
  padding: 1px 7px;
  border: 1px solid #dcdcdc;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .4px;
}
.thumb {
  width: 117px;
  height: 117px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #eee;
}

/* ---------- Sidebar ---------- */
.sidebar { border-left: 1px solid var(--line); padding-left: 31px; }
.panel { padding: 0 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 34px; }
.panel:last-child { border-bottom: 0; }
.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 500;
  margin-bottom: 18px;
}

.chips { display: flex; flex-wrap: wrap; gap: 10px 8px; padding-bottom: 12px; }
.chip {
  padding: 7px 12px;
  border: 1px solid #dcdcdc;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}
.chip:hover { background: var(--field); }

.reading { display: flex; gap: 20px; align-items: center; padding: 10px 0 16px; }
.reading > div { flex: 1; }
.reading .category { font-size: 13px; }
.reading h3 { margin-top: 4px; font-size: 15px; font-weight: 500; line-height: 1.5; }
.reading img { width: 68px; height: 68px; border-radius: 6px; object-fit: cover; }

/* ---------- Favoris & notifications ---------- */
.icon-btn { position: relative; }
.count {
  position: absolute;
  top: -7px; right: -9px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
}
.count.alert { background: #e0362c; }
.tab-count { font-weight: 500; color: var(--soft); }

.bell-wrap { position: relative; }
.dropdown {
  position: absolute;
  top: 38px; right: -10px;
  width: 380px;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.22);
  z-index: 20;
}
.dropdown-head {
  position: sticky; top: 0;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.dropdown-head span { font-size: 12px; color: var(--soft); }
.bell-section { padding: 10px 8px 6px; }
.bell-section + .bell-section { border-top: 1px solid var(--line); }
.bell-cat { display: block; padding: 0 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.bell-item { display: block; padding: 8px 10px; border-radius: 8px; }
.bell-item:hover { background: var(--field); }
.bell-item.unread { position: relative; padding-left: 22px; }
.bell-item.unread::before { content: ""; position: absolute; left: 9px; top: 15px; width: 6px; height: 6px; border-radius: 50%; background: #e0362c; }
.bell-title { display: block; font-size: 13px; font-weight: 500; line-height: 1.4; }
.bell-meta { font-size: 12px; color: var(--soft); }

.article-actions {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-right: -24px;
  flex-shrink: 0;
}
.bookmark, .ask-ai {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  color: #9a9a9a;
}
.bookmark:hover, .ask-ai:hover { background: var(--field); color: var(--text); }
.bookmark.on { color: var(--text); }
.bookmark.on svg { fill: currentColor; }
.ask-ai:hover { color: var(--ai); }

/* ---------- Compte ---------- */
.account-wrap { position: relative; }
.account-btn { width: 32px; height: 32px; }
.avatar {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.avatar.lg { width: 44px; height: 44px; font-size: 18px; flex-shrink: 0; }
.account-panel { width: 340px; }
.account-body { padding: 16px 18px 18px; }
.account-body form { display: grid; gap: 12px; }
.account-body label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.account-body input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.account-body input:focus { border-color: var(--text); }
.segmented { display: flex; padding: 3px; margin-bottom: 16px; background: var(--field); border-radius: 9px; }
.segmented button { flex: 1; padding: 7px 0; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); }
.segmented button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.btn-primary, .btn-secondary {
  height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.btn-primary { background: var(--text); color: #fff; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-secondary { width: 100%; border: 1px solid #dcdcdc; }
.btn-secondary:hover { background: var(--field); }
.form-error { padding: 9px 12px; border-radius: 8px; background: #fdecea; color: #b3261e; font-size: 13px; }
.form-note { font-size: 12px; line-height: 1.5; color: var(--soft); }
.account-id { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.account-id strong { display: block; font-size: 14px; font-weight: 600; word-break: break-all; }
.account-id span { font-size: 12px; color: var(--soft); }
.account-body .form-note + .btn-secondary { margin-top: 14px; }

/* ---------- Assistant IA ---------- */
.tab-ai { display: inline-flex; align-items: center; gap: 6px; }
.tab-ai svg { color: var(--ai); }

.ai { display: flex; flex-direction: column; gap: 16px; }
.ai-head h2 { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 600; }
.ai-head h2 svg { width: 24px; height: 24px; color: var(--ai); }
.ai-head p { margin-top: 4px; font-size: 14px; color: var(--muted); }

.ai-context {
  display: flex; align-items: center; gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}
.ai-context img { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.ai-context > div { flex: 1; min-width: 0; }
.ai-context a { display: block; margin-top: 2px; font-size: 14px; font-weight: 600; line-height: 1.4; }
.ai-context a:hover { text-decoration: underline; }
.ai-context .icon-btn { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; color: var(--muted); }
.ai-context .icon-btn:hover { background: var(--field); }
.ai-tip { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--ai-soft); font-size: 13px; color: #3d3566; }
.ai-tip svg { flex-shrink: 0; color: var(--ai); }

.ai-gate { padding: 36px 24px; border: 1px dashed #d6d6d6; border-radius: 12px; text-align: center; }
.ai-gate p { margin-bottom: 16px; color: var(--muted); font-size: 15px; }
.ai-gate p:last-child { margin-bottom: 0; }

.ai-messages {
  display: flex; flex-direction: column; gap: 12px;
  min-height: 280px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 2px;
}
.ai-suggestions { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.ai-suggestions span { width: 100%; font-size: 12px; font-weight: 600; color: var(--soft); text-transform: uppercase; letter-spacing: .5px; }
.ai-suggestions .chip { background: #fff; text-align: left; }

.msg { max-width: 88%; padding: 12px 15px; border-radius: 14px; font-size: 14px; line-height: 1.6; }
.msg.user { align-self: flex-end; background: var(--text); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--field); border-bottom-left-radius: 4px; }
.msg.error { background: #fdecea; color: #b3261e; }
.msg p + p, .msg p + ul, .msg p + ol, .msg ul + p, .msg ol + p, .msg h4 + p { margin-top: 8px; }
.msg h4 { margin: 12px 0 4px; font-size: 14px; font-weight: 600; }
.msg h4:first-child { margin-top: 0; }
.msg ul, .msg ol { padding-left: 20px; margin: 6px 0; }
.msg li + li { margin-top: 3px; }
.msg code { padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.07); font-size: 13px; }
.msg a { text-decoration: underline; }
.msg-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #dedede; }
.msg-sources span { width: 100%; font-size: 11px; font-weight: 600; color: var(--soft); text-transform: uppercase; letter-spacing: .5px; }
.msg-sources a {
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 9px;
  border: 1px solid #d6d6d6; border-radius: 999px;
  background: #fff;
  font-size: 12px;
  text-decoration: none;
}
.msg-sources a:hover { border-color: var(--text); }
.typing { display: flex; gap: 5px; padding: 16px 18px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9a9a9a; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.ai-input {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 8px 8px 8px 16px;
  border: 1px solid #dcdcdc;
  border-radius: 14px;
  background: #fff;
}
.ai-input:focus-within { border-color: var(--text); }
.ai-input textarea {
  flex: 1;
  min-height: 24px;
  max-height: 160px;
  padding: 8px 0;
  border: 0;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
}
.ai-input button {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  flex-shrink: 0;
}
.ai-input button:disabled { opacity: .4; cursor: default; }
.ai-foot { font-size: 12px; color: var(--soft); line-height: 1.5; }

.badge-new {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e8f5e9;
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
}
.category b { font-weight: 600; color: var(--text); }

.placeholder {
  display: grid; place-items: center;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #1b1b1b, #4a4a4a);
}
.placeholder.Work { background: linear-gradient(135deg, #2b3a55, #5d7396); }

.status { margin-top: 18px; font-size: 13px; color: var(--soft); }
.results-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 22px 0 0;
  font-size: 14px;
  font-weight: 500;
}
.link-btn { font-size: 13px; color: var(--muted); text-decoration: underline; }
.empty { padding: 40px 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.empty.small { padding: 4px 10px 12px; font-size: 13px; }
.sidebar .empty.small { padding: 0 0 12px; }

.skeleton { align-items: center; }
.skeleton div { flex: 1; height: 96px; border-radius: 8px; background: linear-gradient(90deg, #f3f3f3, #e9e9e9, #f3f3f3); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton span { width: 117px; height: 117px; border-radius: 6px; background: #f0f0f0; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.4);
  z-index: 30;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .container { padding: 0 32px; }
  .topbar { gap: 40px; }
  .layout { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 32px; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .topbar { flex-wrap: wrap; gap: 10px 14px; height: auto; padding: 12px 0 6px; }
  .topbar .logo { flex: 1; }
  .topbar .search { order: 3; flex-basis: 100%; height: 42px; }
  .logo { font-size: 20px; }
  .actions { gap: 16px; margin-left: 0; }
  .search { min-width: 0; padding: 0 14px; }
  .logo { font-size: 20px; }
  .dropdown { position: fixed; top: 56px; left: 16px; right: 16px; width: auto; }
  .article-actions { margin-right: -10px; gap: 0; }
  .msg { max-width: 94%; }
  .ai-messages { max-height: none; }
  .skeleton span { width: 84px; height: 84px; }
  .hero { flex-direction: column; align-items: flex-start; justify-content: center; gap: 12px; height: auto; padding: 20px; }
  .hero h1 { font-size: 20px; }
  .article { gap: 16px; }
  .thumb { width: 84px; height: 84px; }
  .excerpt { -webkit-line-clamp: 2; font-size: 14px; }
}
