:root {
  --ink: #0e1b2c;
  --text: #2a3445;
  --muted: #6b7686;
  --line: #e3e7ed;
  --bg: #f6f8fb;
  --side: #ffffff;
  --accent: #00a3c4;
  --accent-ink: #007f99;
  --accent-soft: #e3f7fb;
  --danger: #c62f2f;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --radius: 10px;
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14.5px/1.45 var(--font); color: var(--text); background: var(--bg); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
h1, h2, h3 { color: var(--ink); margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f1f4f8; }
.btn--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--primary:hover { background: #1c2f48; }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); border-color: #f0caca; }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }

input, select, textarea { font: inherit; color: var(--ink); padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0, 163, 196, 0.35); border-color: var(--accent); }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.error { color: var(--danger); margin: 0; min-height: 1.2em; font-size: 13.5px; }

/* connexion */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(900px 500px at 80% 0%, #dff6fb, transparent 60%), var(--bg); padding: 20px; }
.login__card { width: min(420px, 100%); background: #fff; border-radius: 16px; padding: 36px; box-shadow: 0 20px 60px rgba(14, 27, 44, 0.12); display: grid; gap: 16px; }
.login__logos { display: flex; align-items: center; justify-content: center; gap: 14px; }
.login__logos img { height: 44px; }
.login__logos span { color: var(--muted); font-size: 20px; }
.login h1 { font-size: 16px; text-align: center; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

/* structure */
.app { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: 60px 1fr; height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 24px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.top__brand { display: flex; align-items: center; gap: 10px; flex: none; min-width: 228px; }
.top__brand img { height: 30px; }
.top__brand .x { color: var(--muted); }
.top__search { flex: 1; max-width: 640px; position: relative; }
.top__search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: var(--muted); }
.top__search input { padding-left: 38px; background: var(--bg); border-color: transparent; }
.top__user { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.top__user b { color: var(--ink); }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.side .new { position: relative; margin-bottom: 14px; }
.side a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.side a:hover { background: var(--bg); }
.side a.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side__foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 12px; }
.count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 12px; text-align: center; }
.main { position: relative; overflow: auto; padding: 22px 28px 40px; }

/* menu */
.menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(14, 27, 44, 0.16); padding: 6px; display: grid; }
.menu button { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--bg); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ctx { position: fixed; }

/* icônes (CSS, sans dépendance) */
.ic { width: 20px; height: 20px; flex: none; display: inline-block; background: center / contain no-repeat; }
.ic-folder { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23f2b33d' d='M3 6.5A1.5 1.5 0 0 1 4.5 5h5l2 2h8A1.5 1.5 0 0 1 21 8.5v9A1.5 1.5 0 0 1 19.5 19h-15A1.5 1.5 0 0 1 3 17.5z'/%3E%3C/svg%3E"); }
.ic-ao { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2300a3c4' d='M3 6.5A1.5 1.5 0 0 1 4.5 5h5l2 2h8A1.5 1.5 0 0 1 21 8.5v9A1.5 1.5 0 0 1 19.5 19h-15A1.5 1.5 0 0 1 3 17.5z'/%3E%3Cpath fill='%23fff' d='M8 12.5l2.2 2.2L16 9l1.1 1.1-6.9 6.9L6.9 13.6z'/%3E%3C/svg%3E"); }
.ic-docx { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='18' height='18' rx='3' fill='%232b579a'/%3E%3Cpath fill='%23fff' d='M6.5 8h1.6l1.1 5 1.3-5h1.4l1.3 5 1.1-5h1.6l-2 8h-1.4L11.2 11l-1.3 5H8.5z'/%3E%3C/svg%3E"); }
.ic-xlsx { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='18' height='18' rx='3' fill='%23217346'/%3E%3Cpath fill='%23fff' d='M7.5 8h2l1.9 3 1.9-3h2l-2.9 4 2.9 4h-2l-1.9-3-1.9 3h-2l2.9-4z'/%3E%3C/svg%3E"); }
.ic-pptx { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='18' height='18' rx='3' fill='%23c43e1c'/%3E%3Cpath fill='%23fff' d='M8.5 8h3.7a2.6 2.6 0 0 1 0 5.2h-2V16H8.5zm1.7 1.5v2.2h1.9a1.1 1.1 0 0 0 0-2.2z'/%3E%3C/svg%3E"); }
.ic-pdf { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='18' height='18' rx='3' fill='%23d93025'/%3E%3Ctext x='12' y='15.5' font-family='Arial' font-size='7' font-weight='700' fill='%23fff' text-anchor='middle'%3EPDF%3C/text%3E%3C/svg%3E"); }
.ic-zip { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='3' width='16' height='18' rx='2.5' fill='%237a6a53'/%3E%3Cpath fill='%23fff' d='M11 4h2v2h-2zm0 3h2v2h-2zm0 3h2v2h-2zm-1 4h4v4h-4z'/%3E%3C/svg%3E"); }
.ic-img { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='4' width='18' height='16' rx='2.5' fill='%237d5ad6'/%3E%3Cpath fill='%23fff' d='M6 17l4-5 3 3.5 2-2.5 3 4z'/%3E%3Ccircle cx='15.5' cy='8.5' r='1.6' fill='%23fff'/%3E%3C/svg%3E"); }
.ic-file { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2390a0b4' d='M6 2h8l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z'/%3E%3Cpath fill='%23d7dee8' d='M14 2v5h5z'/%3E%3C/svg%3E"); }
.ic-todo { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='3' width='16' height='18' rx='3' fill='none' stroke='%232a3445' stroke-width='1.8'/%3E%3Cpath d='M8 9l1.5 1.5L12 8M8 15l1.5 1.5L12 14' fill='none' stroke='%2300a3c4' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ic-clock { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='8.5' fill='none' stroke='%232a3445' stroke-width='1.8'/%3E%3Cpath d='M12 7.5V12l3 2' fill='none' stroke='%232a3445' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ic-pulse { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 12h4l2.5-6 4 12 2.5-6h5' fill='none' stroke='%232a3445' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ic-trash { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 7h14M9 7V4.5h6V7m-8 0 1 13h8l1-13' fill='none' stroke='%232a3445' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ic-up { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 16V4m-5 5 5-5 5 5M5 20h14' fill='none' stroke='%232a3445' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ic-note { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 4h14v11l-5 5H5z' fill='%23ffd666'/%3E%3Cpath d='M14 20v-5h5' fill='%23f2b33d'/%3E%3C/svg%3E"); }

/* en-tête de vue */
.vhead { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.vhead h1 { font-size: 22px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 18px; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 2px 6px; border-radius: 6px; }
.crumbs a:hover { background: #fff; color: var(--ink); }
.crumbs a:last-child { color: var(--ink); font-weight: 700; }
.crumbs span { color: #b5bfcc; }
.vhead__tools { margin-left: auto; display: flex; gap: 8px; }

/* liste des fichiers */
.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 170px 150px 90px 44px; gap: 12px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--line); cursor: default; user-select: none; }
.row:first-child { border-top: 0; }
.row--head { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: #fbfcfd; }
.row:not(.row--head):hover { background: #f7fbfd; }
.row.is-sel { background: var(--accent-soft); }
.row.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.row__name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row__name a, .row__name span.n { color: var(--ink); font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.row__name a:hover { text-decoration: underline; }
.row__meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__more { border: 0; background: none; border-radius: 6px; width: 32px; height: 30px; cursor: pointer; font-size: 18px; color: var(--muted); }
.row__more:hover { background: var(--bg); color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge--note { background: #fff4cc; color: #8a5a00; }
.badge--ao { background: var(--accent-soft); color: var(--accent-ink); }
.badge--late { background: #fde2e2; color: var(--danger); }
.badge--soon { background: #fff1d6; color: var(--warn); }
.badge--ok { background: #e2f5ea; color: var(--ok); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }

/* en-tête d'un dossier AO */
.aohead { display: grid; grid-template-columns: 1fr 340px; gap: 16px; margin-bottom: 18px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card h2 { font-size: 15px; margin-bottom: 12px; }
.aoinfo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; }
.aoinfo dt { font-size: 12px; color: var(--muted); }
.aoinfo dd { margin: 2px 0 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.countdown { font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1; }
.countdown small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 6px; }
.progress { height: 8px; border-radius: 99px; background: #edf1f5; overflow: hidden; margin: 10px 0 4px; }
.progress span { display: block; height: 100%; background: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 2px; max-height: 260px; overflow: auto; }
.checklist label { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--text); font-size: 13.5px; padding: 4px 2px; cursor: pointer; }
.checklist input { width: auto; }
.checklist .is-done { color: var(--muted); text-decoration: line-through; }
.checklist small { margin-left: auto; color: var(--muted); font-size: 11.5px; }

/* tableau de bord AO */
.aogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.aocard { display: grid; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; text-decoration: none; color: var(--text); transition: box-shadow 0.15s, border-color 0.15s; }
.aocard:hover { border-color: var(--accent); box-shadow: 0 10px 28px rgba(14, 27, 44, 0.08); }
.aocard h3 { font-size: 16px; }
.aocard__meta { font-size: 13px; color: var(--muted); }
.aocard__foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }

/* notes / activité */
.notes { display: grid; gap: 10px; }
.note { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; background: #fff; border: 1px solid var(--line); border-left: 4px solid #f2b33d; border-radius: var(--radius); padding: 14px 16px; }
.note--done { border-left-color: var(--ok); opacity: 0.75; }
.note__who { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--ink); }
.note__who.meir { background: #7d5ad6; }
.note__who.nathan { background: var(--accent); }
.note__text { white-space: pre-wrap; color: var(--ink); }
.note__meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.note__meta a { cursor: pointer; }
.note__actions { display: flex; gap: 6px; }
h2.section { font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 26px 0 10px; }
.feed { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.feed div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13.5px; }
.feed div:first-child { border-top: 0; }
.feed time { color: var(--muted); }

/* éditeur */
.editor { position: fixed; inset: 0; z-index: 50; background: #fff; display: flex; flex-direction: column; }
.editor__bar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--ink); color: #fff; }
.editor__bar span:first-child { font-weight: 600; }
.editor__hint { color: #9fb1c7; font-size: 12.5px; margin-right: auto; }
.editor__bar .btn--primary { background: var(--accent); border-color: var(--accent); }
.editor iframe { flex: 1; border: 0; width: 100%; }

/* fenêtres */
.dlg { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(14, 27, 44, 0.3); }
.dlg::backdrop { background: rgba(14, 27, 44, 0.45); }
.dlg form { padding: 24px; display: grid; gap: 14px; }
.dlg h2 { font-size: 18px; }
.dlg p { margin: 0; color: var(--muted); }
.dlg .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.dlg .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg textarea { min-height: 110px; resize: vertical; }
.dlg .tree { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.dlg .tree button { display: flex; width: 100%; gap: 8px; align-items: center; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.dlg .tree button:hover, .dlg .tree button.is-sel { background: var(--accent-soft); }

/* dépôt / envois */
.dropzone { position: absolute; inset: 12px; border: 3px dashed var(--accent); border-radius: 16px; background: rgba(227, 247, 251, 0.92); display: grid; place-items: center; font-size: 18px; font-weight: 600; color: var(--accent-ink); pointer-events: none; }
.uploads { position: fixed; right: 20px; bottom: 20px; width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(14, 27, 44, 0.18); padding: 12px 14px; display: grid; gap: 8px; z-index: 40; font-size: 13px; }
.uploads .u { display: grid; gap: 4px; }
.uploads .u span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 11px 18px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; opacity: 0; pointer-events: none; transition: 0.2s; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 60px auto 1fr; }
  .side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .side .new { margin: 0 8px 0 0; }
  .side a { white-space: nowrap; }
  .side__foot, .top__brand .x, .top__brand img + span + img { display: none; }
  .top__brand { width: auto; }
  .row { grid-template-columns: minmax(0, 1fr) 44px; }
  .row > :nth-child(2), .row > :nth-child(3), .row > :nth-child(4) { display: none; }
  .aohead { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
