/* =====================================================================
   StudyMate — design system
   Inspiré des interfaces Apple : sobriété, matières translucides,
   typographie serrée, rayons généreux, mouvements doux.
   ===================================================================== */

@font-face {
  font-family: "Inter var";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter var";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter var", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter var", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --bg: #f5f5f7;
  --bg-elev: #ffffff;
  --bg-elev-2: #fbfbfd;
  --bg-glass: rgba(255, 255, 255, .72);
  --sidebar: rgba(242, 242, 246, .78);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --sep: rgba(60, 60, 67, .11);
  --sep-strong: rgba(60, 60, 67, .2);
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .07);
  --fill-hover: rgba(118, 118, 128, .16);
  --bubble: #e9e9eb;

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-press: #006edb;
  --accent-soft: rgba(0, 113, 227, .1);
  --accent-text: #0066cc;
  --green: #34c759;
  --green-text: #248a3d;
  --green-soft: rgba(52, 199, 89, .14);
  --orange: #ff9500;
  --orange-text: #c93400;
  --orange-soft: rgba(255, 149, 0, .14);
  --red: #ff3b30;
  --red-text: #d70015;
  --red-soft: rgba(255, 59, 48, .1);
  --purple: #af52de;
  --purple-soft: rgba(175, 82, 222, .12);
  --indigo: #5856d6;

  --r-xs: 8px;
  --r-s: 10px;
  --r: 14px;
  --r-l: 20px;
  --r-xl: 26px;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .04), 0 0 0 .5px rgba(0, 0, 0, .04);
  --sh-2: 0 6px 24px -6px rgba(0, 0, 0, .1), 0 1px 3px rgba(0, 0, 0, .05), 0 0 0 .5px rgba(0, 0, 0, .04);
  --sh-pop: 0 24px 70px -12px rgba(0, 0, 0, .28), 0 4px 14px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .06);

  --ease: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --titlebar: 0px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-elev: #1c1c1e;
  --bg-elev-2: #161618;
  --bg-glass: rgba(28, 28, 30, .72);
  --sidebar: rgba(22, 22, 24, .78);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #76767c;
  --sep: rgba(84, 84, 88, .36);
  --sep-strong: rgba(84, 84, 88, .6);
  --fill: rgba(118, 118, 128, .24);
  --fill-2: rgba(118, 118, 128, .14);
  --fill-hover: rgba(118, 118, 128, .3);
  --bubble: #262628;
  --accent: #0a84ff;
  --accent-hover: #2b95ff;
  --accent-press: #0a7aeb;
  --accent-soft: rgba(10, 132, 255, .18);
  --accent-text: #4da3ff;
  --green: #30d158;
  --green-text: #30d158;
  --green-soft: rgba(48, 209, 88, .16);
  --orange: #ff9f0a;
  --orange-text: #ffb340;
  --orange-soft: rgba(255, 159, 10, .16);
  --red: #ff453a;
  --red-text: #ff6961;
  --red-soft: rgba(255, 69, 58, .16);
  --purple-soft: rgba(191, 90, 242, .18);
  --sh-1: 0 0 0 .5px rgba(255, 255, 255, .06);
  --sh-2: 0 8px 28px -8px rgba(0, 0, 0, .6), 0 0 0 .5px rgba(255, 255, 255, .07);
  --sh-pop: 0 30px 80px -10px rgba(0, 0, 0, .7), 0 0 0 .5px rgba(255, 255, 255, .1);
  color-scheme: dark;
}

.is-desktop { --titlebar: 34px; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -.011em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss03";
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
::selection { background: var(--accent-soft); }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 650; letter-spacing: -.022em; line-height: 1.15; }
p { margin: 0; }
hr { border: 0; height: 1px; background: var(--sep); margin: 20px 0; }
.ic { flex-shrink: 0; display: inline-block; vertical-align: middle; }
[hidden] { display: none !important; }

/* Scrollbars discrets */
* { scrollbar-width: thin; scrollbar-color: rgba(128, 128, 128, .35) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, .32); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(128, 128, 128, .5); }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------ desktop titlebar */
.titlebar {
  position: fixed; inset: 0 0 auto 0; height: var(--titlebar); z-index: 200;
  -webkit-app-region: drag; display: none; align-items: center; justify-content: center;
  pointer-events: none;
}
.is-desktop .titlebar { display: flex; }
.titlebar-title { font-size: 12.5px; font-weight: 600; color: var(--text-3); letter-spacing: -.005em; }

/* ------------------------------------------------------------ layout app */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100vh; }
.sidebar {
  position: relative; height: 100vh; overflow: hidden; display: flex; flex-direction: column;
  background: var(--sidebar); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: .5px solid var(--sep-strong); padding: calc(var(--titlebar) + 14px) 12px 12px;
}
.main { height: 100vh; overflow-y: auto; overflow-x: hidden; position: relative; padding-top: var(--titlebar); scroll-behavior: smooth; }
.main.no-scroll { overflow: hidden; display: flex; flex-direction: column; }
.page { max-width: 1140px; margin: 0 auto; padding: 34px 44px 90px; animation: pageIn .45s var(--ease) both; }
.page-narrow { max-width: 760px; }
.page-wide { max-width: 1320px; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), inset 0 0 0 .5px rgba(0, 0, 0, .1); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.025em; }
.brand-name span { color: var(--accent); }

.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; margin: 0 2px 14px;
  border-radius: 9px; background: var(--fill); color: var(--text-3); font-size: 13.5px; width: calc(100% - 4px);
  transition: background .2s;
}
.search-trigger:hover { background: var(--fill-hover); }
.search-trigger kbd { margin-left: auto; font: 500 11px var(--font); color: var(--text-3); background: var(--bg-elev); border-radius: 5px; padding: 1px 6px; box-shadow: var(--sh-1); }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-scroll { flex: 1; overflow-y: auto; margin: 0 -12px; padding: 0 12px 10px; }
.nav-label { font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 16px 10px 6px; letter-spacing: .01em; display: flex; align-items: center; justify-content: space-between; }
.nav-label a { color: var(--text-3); display: flex; padding: 2px; border-radius: 5px; }
.nav-label a:hover { color: var(--accent); background: var(--fill); }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 5px 10px; border-radius: 9px;
  color: var(--text); font-size: 14px; font-weight: 500; position: relative; transition: background .15s;
}
.nav-item:hover { background: var(--fill-2); }
.nav-item.active { background: var(--fill); }
.nav-item .ic { color: var(--accent); }
.nav-item .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .sub { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 450; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -1px; }
.nav-item.group-item { padding: 5px 8px; }
.nav-item.group-item.unread .txt { font-weight: 650; }

.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 650; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.badge.red { background: var(--red); }
.badge.soft { background: var(--fill); color: var(--text-2); }
.badge:empty, .badge[data-count="0"] { display: none; }

.sidebar-foot { border-top: .5px solid var(--sep); margin: 0 -12px; padding: 10px 12px 0; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; color: var(--text); }
.me-card:hover { background: var(--fill-2); }
.me-card .meta { flex: 1; min-width: 0; line-height: 1.25; }
.me-card .meta strong { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-card .meta span { font-size: 12px; color: var(--text-3); }

/* Barre d'onglets mobile */
.tabbar { display: none; }

/* ------------------------------------------------------------ typographie */
.eyebrow { font-size: 13px; font-weight: 600; color: var(--text-3); letter-spacing: -.005em; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.title-xl { font-size: 34px; font-weight: 700; letter-spacing: -.028em; line-height: 1.1; }
.title-l { font-size: 26px; font-weight: 700; letter-spacing: -.024em; }
.title-m { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.title-s { font-size: 16px; font-weight: 650; letter-spacing: -.016em; }
.lead { font-size: 17px; color: var(--text-2); letter-spacing: -.014em; line-height: 1.45; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .lead { margin-top: 8px; max-width: 620px; }
.section { margin-top: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head > a:not(.flex) { font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 2px; }

/* ------------------------------------------------------------ boutons */
.btn {
  --h: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--h); padding: 0 17px;
  border-radius: 999px; font-size: 14px; font-weight: 550; letter-spacing: -.01em; white-space: nowrap; user-select: none;
  transition: background .2s, transform .15s var(--ease), box-shadow .2s, opacity .2s, color .2s; position: relative;
  background: var(--fill); color: var(--text);
}
.btn:hover { background: var(--fill-hover); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.is-loading { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); }
.btn-tinted { background: var(--accent-soft); color: var(--accent-text); }
.btn-tinted:hover { background: rgba(0, 113, 227, .16); }
[data-theme="dark"] .btn-tinted:hover { background: rgba(10, 132, 255, .26); }
.btn-ghost { background: transparent; color: var(--accent-text); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-plain { background: transparent; color: var(--text-2); }
.btn-plain:hover { background: var(--fill-2); color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red-text); }
.btn-danger:hover { background: rgba(255, 59, 48, .16); }
.btn-solid-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green-soft); color: var(--green-text); }
.btn-dark { background: var(--text); color: var(--bg); }
.btn-sm { --h: 30px; padding: 0 13px; font-size: 13px; gap: 5px; }
.btn-xs { --h: 26px; padding: 0 10px; font-size: 12.5px; gap: 4px; }
.btn-lg { --h: 46px; padding: 0 24px; font-size: 16px; }
.btn-xl { --h: 54px; padding: 0 30px; font-size: 17px; font-weight: 600; }
.btn-block { width: 100%; }
.btn-icon { width: var(--h); padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn.is-loading > * { visibility: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { color: var(--accent-text); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; }

/* ------------------------------------------------------------ formulaires */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); letter-spacing: -.005em; }
.field .hint { font-size: 12.5px; color: var(--text-3); }
.field .error { font-size: 12.5px; color: var(--red-text); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; background: var(--bg-elev);
  border: 1px solid var(--sep-strong); font-size: 15px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.is-invalid { border-color: var(--red); }
.input-filled { background: var(--fill-2); border-color: transparent; }
.input-filled:focus { background: var(--bg-elev); }
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.select {
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.input-group { position: relative; }
.input-group .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-group .input { padding-left: 40px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* Interrupteur iOS */
.switch { position: relative; display: inline-flex; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; background: var(--fill); border-radius: 31px; cursor: pointer;
  transition: background .25s var(--ease);
}
.switch span::before {
  content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06); transition: transform .3s var(--spring);
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-soft); }
[data-theme="dark"] .switch span { background: rgba(120, 120, 128, .32); }

/* Contrôle segmenté */
.seg { display: inline-flex; padding: 2px; background: var(--fill); border-radius: 10px; gap: 2px; position: relative; }
.seg > * {
  height: 30px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; transition: background .2s, box-shadow .2s, color .2s; white-space: nowrap;
}
.seg > *:hover:not(.on) { color: var(--text); background: rgba(255, 255, 255, .35); }
[data-theme="dark"] .seg > *:hover:not(.on) { background: rgba(255, 255, 255, .06); }
.seg > .on { background: var(--bg-elev); box-shadow: 0 3px 8px rgba(0, 0, 0, .08), 0 3px 1px rgba(0, 0, 0, .03), 0 0 0 .5px rgba(0, 0, 0, .04); }
[data-theme="dark"] .seg > .on { background: #636366; }
.seg-lg > * { height: 36px; padding: 0 18px; font-size: 14px; }
.seg-block { display: flex; }
.seg-block > * { flex: 1; justify-content: center; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--fill-2); color: var(--text); font-size: 13px; font-weight: 500; transition: all .2s var(--ease); white-space: nowrap;
  border: 1px solid transparent;
}
a.chip:hover, button.chip:hover { background: var(--fill); }
.chip.on { background: var(--accent); color: #fff; }
.chip .tile { width: 18px; height: 18px; font-size: 8px; border-radius: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; letter-spacing: -.005em; white-space: nowrap; }
.pill-need { background: var(--orange-soft); color: var(--orange-text); }
.pill-help { background: var(--green-soft); color: var(--green-text); }
.pill-member { background: var(--fill); color: var(--text-2); }
.pill-blue { background: var(--accent-soft); color: var(--accent-text); }
.pill-purple { background: var(--purple-soft); color: var(--purple); }
.pill-red { background: var(--red-soft); color: var(--red-text); }
.pill-gray { background: var(--fill); color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }

/* ------------------------------------------------------------ surfaces */
.card { background: var(--bg-elev); border-radius: var(--r-l); box-shadow: var(--sh-1); }
.card-pad { padding: 22px; }
.card-pad-l { padding: 28px; }
.card-hover { transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.inset { background: var(--fill-2); border-radius: var(--r); padding: 14px 16px; }

.grid { display: grid; gap: 16px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-cards-s { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }

/* Listes façon Réglages iOS */
.list { background: var(--bg-elev); border-radius: var(--r-l); box-shadow: var(--sh-1); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; position: relative; min-height: 56px; color: var(--text); }
.list-row + .list-row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: .5px; background: var(--sep); }
.list-row.with-icon + .list-row.with-icon::before { left: 62px; }
a.list-row:hover, .list-row.clickable:hover { background: var(--fill-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 550; font-size: 14.5px; }
.list-row .desc { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.list-row .chev { color: var(--text-3); }
.list-head { font-size: 13px; color: var(--text-2); font-weight: 500; padding: 0 18px 8px; }
.list-foot { font-size: 12.5px; color: var(--text-3); padding: 8px 18px 0; }

/* Tuile matière & avatar */
.tile {
  --h: 211; --s: 40px;
  width: var(--s); height: var(--s); border-radius: calc(var(--s) * .27); flex-shrink: 0;
  background: linear-gradient(145deg, hsl(var(--h) 85% 64%), hsl(calc(var(--h) + 28) 78% 50%));
  color: #fff; display: grid; place-items: center; font-family: var(--font-display);
  font-weight: 700; font-size: calc(var(--s) * .34); letter-spacing: -.03em;
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .25);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .12);
}
.tile[data-len="3"] { font-size: calc(var(--s) * .3); }
.tile[data-len="4"] { font-size: calc(var(--s) * .25); letter-spacing: -.04em; }
.tile-xs { --s: 22px; } .tile-s { --s: 30px; } .tile-m { --s: 40px; } .tile-l { --s: 56px; } .tile-xl { --s: 76px; }

.avatar {
  --h: 211; --s: 36px;
  width: var(--s); height: var(--s); border-radius: 50%; flex-shrink: 0; position: relative;
  background: linear-gradient(160deg, hsl(var(--h) 60% 70%), hsl(calc(var(--h) + 20) 55% 52%));
  color: #fff; display: grid; place-items: center; font-weight: 650; font-size: calc(var(--s) * .38); letter-spacing: -.02em;
  font-family: var(--font-display);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar .presence {
  position: absolute; right: -1px; bottom: -1px; width: calc(var(--s) * .3); height: calc(var(--s) * .3); min-width: 9px; min-height: 9px;
  border-radius: 50%; background: var(--green); border: 2px solid var(--bg-elev); display: none;
}
.avatar.online .presence { display: block; }
.av-xs { --s: 22px; } .av-s { --s: 28px; } .av-m { --s: 36px; } .av-l { --s: 48px; } .av-xl { --s: 72px; } .av-xxl { --s: 112px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--bg-elev); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.avatar-stack .more { --s: 28px; width: var(--s); height: var(--s); border-radius: 50%; background: var(--fill); color: var(--text-2); font-size: 11px; font-weight: 600; display: grid; place-items: center; margin-left: -8px; box-shadow: 0 0 0 2px var(--bg-elev); }

/* États vides */
.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .empty-ic { width: 64px; height: 64px; border-radius: 20px; background: var(--fill-2); color: var(--text-3); display: grid; place-items: center; margin-bottom: 6px; }
.empty h3 { font-size: 18px; }
.empty p { color: var(--text-2); max-width: 380px; font-size: 14.5px; }
.empty .btn { margin-top: 8px; }

/* Bandeaux */
.banner { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: var(--r); font-size: 14px; font-weight: 500; margin-bottom: 20px; }
.banner-info { background: var(--accent-soft); color: var(--accent-text); }
.banner-success { background: var(--green-soft); color: var(--green-text); }
.banner-warning { background: var(--orange-soft); color: var(--orange-text); }
.banner-error { background: var(--red-soft); color: var(--red-text); }
.announce { margin: 0; border-radius: 0; justify-content: center; padding: 9px 20px; font-size: 13.5px; }
.demo-flag {
  display: flex; align-items: center; gap: 9px; margin: 0 2px 10px; padding: 8px 12px; border-radius: 10px;
  background: var(--purple-soft); color: var(--purple); font-size: 12.5px; font-weight: 600; line-height: 1.25;
}
.demo-flag:hover { filter: brightness(1.05); }
.demo-flag .dot { background: var(--purple); flex-shrink: 0; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(175, 82, 222, .18); } }

/* ------------------------------------------------------------ dashboard */
.hero-greet { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--bg-elev); border-radius: var(--r-l); padding: 18px 20px; box-shadow: var(--sh-1); }
.stat .k { font-size: 13px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .v { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12.5px; color: var(--text-3); }

.group-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; color: var(--text); min-height: 150px; }
.group-card .top { display: flex; gap: 12px; align-items: flex-start; }
.group-card .name { font-weight: 650; font-size: 15px; letter-spacing: -.015em; line-height: 1.25; }
.group-card .last { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.group-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-3); }

.session-card { padding: 18px; display: flex; gap: 16px; align-items: flex-start; }
.date-badge {
  width: 54px; flex-shrink: 0; border-radius: 13px; overflow: hidden; text-align: center; background: var(--bg-elev);
  box-shadow: 0 0 0 .5px var(--sep-strong), var(--sh-1);
}
.date-badge .m { background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 0 2px; }
.date-badge .d { font-family: var(--font-display); font-size: 24px; font-weight: 650; letter-spacing: -.03em; padding: 3px 0 0; line-height: 1.15; }
.date-badge .w { font-size: 10.5px; color: var(--text-3); font-weight: 600; padding-bottom: 5px; text-transform: capitalize; }
.session-card .body { flex: 1; min-width: 0; }
.session-card h4 { font-size: 15.5px; font-weight: 650; letter-spacing: -.015em; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.meta-line > span { display: inline-flex; align-items: center; gap: 5px; }

.fiche-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; color: var(--text); }
.file-thumb {
  height: 128px; border-radius: 12px; background: var(--fill-2); display: grid; place-items: center; position: relative; overflow: hidden;
}
.file-thumb .doc {
  width: 72px; height: 92px; border-radius: 6px; background: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .1), 0 0 0 .5px rgba(0, 0, 0, .08);
  position: relative; padding: 22px 9px 0;
}
[data-theme="dark"] .file-thumb .doc { background: #2c2c2e; }
.file-thumb .doc::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 16px; border-radius: 6px 6px 0 0; background: hsl(var(--h) 80% 58%); }
.file-thumb .doc i { display: block; height: 4px; border-radius: 2px; background: var(--fill); margin-bottom: 5px; }
.file-thumb .doc i:nth-child(2) { width: 80%; } .file-thumb .doc i:nth-child(3) { width: 60%; } .file-thumb .doc i:nth-child(5) { width: 70%; }
.file-thumb .ext { position: absolute; right: 10px; bottom: 10px; font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: var(--bg-elev); color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fiche-card .title { font-weight: 650; font-size: 14.5px; letter-spacing: -.012em; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fiche-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.like-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--fill-2); transition: all .2s; }
.like-btn:hover { background: var(--fill); }
.like-btn.on { color: #ff2d55; background: rgba(255, 45, 85, .1); }
.like-btn.on .ic { fill: currentColor; }
.like-btn.pop .ic { animation: pop .4s var(--spring); }
@keyframes pop { 50% { transform: scale(1.35); } }

.person-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.person-card .top { display: flex; gap: 12px; align-items: center; }
.person-card .name { font-weight: 650; font-size: 15px; letter-spacing: -.015em; color: var(--text); }
.person-card .sub { font-size: 12.5px; color: var(--text-2); }
.person-card .actions { display: flex; gap: 8px; margin-top: auto; }

/* ------------------------------------------------------------ groupe */
.group-head {
  display: flex; align-items: center; gap: 16px; padding: 16px 28px; border-bottom: .5px solid var(--sep-strong);
  background: var(--bg-glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: relative; z-index: 5; flex-shrink: 0;
}
.group-head .info { flex: 1; min-width: 0; }
.group-head h1 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-head .sub { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 10px; margin-top: 2px; flex-wrap: wrap; }
.group-head .sub .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.group-tabs { display: flex; gap: 2px; padding: 0 24px; border-bottom: .5px solid var(--sep); background: var(--bg-elev-2); flex-shrink: 0; }
.group-tabs button {
  height: 42px; padding: 0 14px; font-size: 14px; font-weight: 550; color: var(--text-2); position: relative; display: inline-flex; align-items: center; gap: 7px;
  transition: color .2s;
}
.group-tabs button:hover { color: var(--text); }
.group-tabs button.on { color: var(--text); }
.group-tabs button.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.group-tabs .count { font-size: 12px; color: var(--text-3); font-weight: 600; }
.group-body { flex: 1; min-height: 0; display: flex; position: relative; }
.tab-panel { flex: 1; min-height: 0; overflow-y: auto; }
.tab-panel.chat-panel { display: flex; overflow: hidden; }
.tab-inner { max-width: 1040px; margin: 0 auto; padding: 28px 32px 60px; }

/* ------------------------------------------------------------ chat */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 28px 8px; display: flex; flex-direction: column; }
.chat-scroll > .chat-inner { margin-top: auto; max-width: 880px; width: 100%; margin-left: auto; margin-right: auto; }
.chat-side { width: 320px; flex-shrink: 0; border-left: .5px solid var(--sep); overflow-y: auto; padding: 22px 20px; background: var(--bg-elev-2); }
.chat-side h3 { font-size: 13px; color: var(--text-2); font-weight: 600; margin: 0 0 10px; letter-spacing: -.005em; }
.chat-side .block + .block { margin-top: 26px; }

.day-sep { text-align: center; margin: 18px 0 10px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.msg { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; position: relative; padding: 0 4px; animation: msgIn .32s var(--ease) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.msg.cont { margin-top: 2px; }
.msg .avatar { --s: 30px; }
.msg.has-next > .avatar { visibility: hidden; }
.msg .stack { display: flex; flex-direction: column; align-items: flex-start; max-width: min(72%, 560px); min-width: 0; }
.msg .who { font-size: 12px; color: var(--text-2); font-weight: 600; margin: 0 0 3px 12px; display: flex; align-items: center; gap: 6px; }
.msg.cont .who { display: none; }
.msg .who .pill { height: 17px; font-size: 10.5px; padding: 0 5px; border-radius: 5px; }
.bubble {
  padding: 8px 13px; border-radius: 19px; background: var(--bubble); color: var(--text); font-size: 15px; line-height: 1.38;
  word-wrap: break-word; overflow-wrap: anywhere; position: relative; white-space: normal; letter-spacing: -.012em;
}
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg:not(.mine).cont .bubble { border-top-left-radius: 6px; }
.msg:not(.mine).has-next .bubble { border-bottom-left-radius: 6px; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .stack { align-items: flex-end; }
.msg.mine .who { display: none; }
.msg.mine .bubble { background: var(--accent); color: #fff; }
.msg.mine.cont .bubble { border-top-right-radius: 6px; }
.msg.mine.has-next .bubble { border-bottom-right-radius: 6px; }
.msg.mine > .avatar { display: none; }
.bubble.jumbo { background: transparent !important; font-size: 40px; padding: 0 4px; line-height: 1.15; }
.msg.question .bubble { box-shadow: inset 0 0 0 1.5px var(--orange); background: var(--orange-soft); }
.msg.mine.question .bubble { box-shadow: none; background: linear-gradient(135deg, #ff9500, #ff6a00); }
.q-tag { display: flex; width: fit-content; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--orange-text); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.msg.mine .q-tag { color: rgba(255, 255, 255, .9); }
.reply-quote { font-size: 12.5px; padding: 6px 10px; border-radius: 12px; margin: 0 0 3px; background: var(--fill-2); color: var(--text-2); max-width: 100%; border-left: 3px solid var(--accent); cursor: pointer; }
.reply-quote strong { color: var(--text); font-weight: 600; }
.msg .time { font-size: 11px; color: var(--text-3); margin: 0 6px 4px; opacity: 0; transition: opacity .2s; white-space: nowrap; align-self: flex-end; }
.msg:hover .time { opacity: 1; }
.msg .receipt { font-size: 11px; color: var(--text-3); margin: 3px 8px 0; font-weight: 500; }
.attach-img { border-radius: 16px; overflow: hidden; max-width: 300px; cursor: zoom-in; box-shadow: 0 0 0 .5px var(--sep); margin-bottom: 2px; }
.attach-img img { max-height: 320px; object-fit: cover; }
.attach-file {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 16px; background: var(--bg-elev);
  box-shadow: 0 0 0 .5px var(--sep-strong); color: var(--text); min-width: 220px; max-width: 320px; margin-bottom: 2px;
}
.attach-file:hover { background: var(--bg-elev-2); }
.attach-file .fi { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.attach-file .fi.pdf { background: var(--red-soft); color: var(--red); }
.attach-file .nm { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-file .sz { font-size: 12px; color: var(--text-3); }
.msg-tools {
  position: absolute; top: -14px; right: 40px; display: none; gap: 2px; padding: 3px; border-radius: 10px;
  background: var(--bg-elev); box-shadow: var(--sh-2); z-index: 3;
}
.msg.mine .msg-tools { right: auto; left: 40px; }
.msg:hover .msg-tools { display: flex; }
.msg-tools button { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--text-2); }
.msg-tools button:hover { background: var(--fill); color: var(--text); }
.msg-tools button.danger:hover { color: var(--red); background: var(--red-soft); }
.msg.flash .bubble { animation: flash 1.2s var(--ease); }
@keyframes flash { 30% { box-shadow: 0 0 0 4px var(--accent-soft); } }

.typing { height: 22px; padding: 0 34px; font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite both; }
.typing-dots i:nth-child(2) { animation-delay: .15s; } .typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

.composer-wrap { padding: 8px 28px 20px; flex-shrink: 0; }
.composer {
  max-width: 880px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 6px;
  border-radius: 24px; background: var(--bg-elev); box-shadow: 0 0 0 .5px var(--sep-strong), 0 6px 22px -10px rgba(0, 0, 0, .18);
  transition: box-shadow .2s;
}
.composer:focus-within { box-shadow: 0 0 0 .5px var(--accent), 0 0 0 4px var(--accent-soft), 0 6px 22px -10px rgba(0, 0, 0, .18); }
.composer textarea {
  flex: 1; border: 0; outline: none; resize: none; background: transparent; font-size: 15px; line-height: 1.4; padding: 8px 4px;
  max-height: 180px; min-height: 36px;
}
.composer .c-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; transition: all .2s; }
.composer .c-btn:hover { background: var(--fill-2); color: var(--text); }
.composer .c-btn.on { color: var(--orange); background: var(--orange-soft); }
.composer .send { background: var(--accent); color: #fff; transform: scale(.9); opacity: .4; pointer-events: none; transition: all .25s var(--spring); }
.composer .send.ready { transform: scale(1); opacity: 1; pointer-events: auto; }
.composer .send:hover { background: var(--accent-hover); color: #fff; }
.composer-extra { max-width: 880px; margin: 0 auto 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.composer-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--fill-2); font-size: 13px; max-width: 100%; }
.composer-chip .x { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.composer-chip .x:hover { background: var(--fill); }
.composer-chip .bar { width: 60px; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.composer-chip .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.join-cta { max-width: 880px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px 14px 20px; border-radius: 20px; background: var(--bg-elev); box-shadow: var(--sh-2); }
.new-pill { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(10px); opacity: 0; pointer-events: none; transition: all .3s var(--spring); z-index: 4; }
.new-pill.show { transform: translateX(-50%); opacity: 1; pointer-events: auto; }
.drop-overlay { position: absolute; inset: 10px; border-radius: 22px; border: 2px dashed var(--accent); background: var(--accent-soft); display: none; place-items: center; z-index: 20; color: var(--accent-text); font-weight: 600; font-size: 16px; backdrop-filter: blur(6px); }
.drop-overlay.show { display: grid; }
.chat-empty { text-align: center; padding: 40px 20px; color: var(--text-2); }

/* ------------------------------------------------------------ messages privés */
.dm-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - var(--titlebar)); }
.dm-list { border-right: .5px solid var(--sep-strong); display: flex; flex-direction: column; min-height: 0; background: var(--bg-elev-2); }
.dm-list-head { padding: 22px 18px 12px; }
.dm-list-scroll { overflow-y: auto; flex: 1; padding: 0 10px 14px; }
.conv { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; color: var(--text); position: relative; }
.conv:hover { background: var(--fill-2); }
.conv.active { background: var(--accent); color: #fff; }
.conv.active .pv, .conv.active .tm { color: rgba(255, 255, 255, .82); }
.conv .grow { flex: 1; min-width: 0; }
.conv .nm { font-weight: 600; font-size: 14.5px; display: flex; justify-content: space-between; gap: 8px; }
.conv .tm { font-size: 12px; color: var(--text-3); font-weight: 450; flex-shrink: 0; }
.conv .pv { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .pv { color: var(--text); font-weight: 550; }
.conv.unread::before { content: ""; position: absolute; left: -2px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--accent); }
.dm-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dm-head { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: .5px solid var(--sep-strong); background: var(--bg-glass); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); }

/* ------------------------------------------------------------ explorer */
.cursus-card { padding: 18px; display: flex; gap: 14px; align-items: center; color: var(--text); }
.cursus-card .grow { flex: 1; min-width: 0; }
.cursus-card .nm { font-weight: 650; font-size: 15px; letter-spacing: -.015em; }
.cursus-card .fn { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursus-card .ct { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.level-head { font-size: 13px; color: var(--text-2); font-weight: 600; margin: 30px 0 12px; display: flex; align-items: center; gap: 10px; }
.level-head::after { content: ""; flex: 1; height: .5px; background: var(--sep); }
.subject-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.subject-row .grow { flex: 1; min-width: 0; }
.subject-row .nm { font-weight: 600; font-size: 15px; color: var(--text); letter-spacing: -.012em; }
.subject-row .ct { font-size: 12.5px; color: var(--text-2); display: flex; gap: 12px; margin-top: 2px; flex-wrap: wrap; }
.subject-row .ct span { display: inline-flex; align-items: center; gap: 4px; }

/* ------------------------------------------------------------ profil */
.profile-hero { padding: 34px; display: flex; gap: 28px; align-items: center; position: relative; overflow: hidden; }
.profile-hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 110px; opacity: .9;
  background: linear-gradient(120deg, hsl(var(--h) 85% 62% / .22), hsl(calc(var(--h) + 60) 80% 60% / .16));
}
.profile-hero > * { position: relative; }
.profile-hero .avatar { box-shadow: 0 0 0 4px var(--bg-elev), var(--sh-2); }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.kv > div { padding: 16px 20px; }
.kv > div + div { border-left: .5px solid var(--sep); }
.kv .v { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kv .k { font-size: 12.5px; color: var(--text-2); }

/* ------------------------------------------------------------ modales */
dialog.modal {
  border: 0; padding: 0; border-radius: 22px; background: var(--bg-elev); color: var(--text); box-shadow: var(--sh-pop);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 60px); overflow: visible;
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .32); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
[data-theme="dark"] dialog.modal::backdrop { background: rgba(0, 0, 0, .55); }
dialog.modal[open] { animation: modalIn .38s var(--spring) both; }
dialog.modal[open]::backdrop { animation: fadeIn .25s ease both; }
dialog.modal.closing { animation: modalOut .2s ease both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modalOut { to { opacity: 0; transform: scale(.97); } }
@keyframes fadeIn { from { opacity: 0; } }
.modal-inner { max-height: calc(100vh - 60px); overflow-y: auto; border-radius: 22px; }
.modal-head { padding: 22px 24px 4px; display: flex; align-items: flex-start; gap: 14px; }
.modal-head h2 { font-size: 20px; flex: 1; }
.modal-head p { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; background: var(--fill); color: var(--text-2); display: grid; place-items: center; flex-shrink: 0; }
.modal-close:hover { background: var(--fill-hover); color: var(--text); }
.modal-body { padding: 16px 24px 8px; }
.modal-foot { padding: 12px 24px 22px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-wide { width: min(680px, calc(100vw - 32px)); }

.dropzone {
  border: 1.5px dashed var(--sep-strong); border-radius: 16px; padding: 26px; text-align: center; cursor: pointer; transition: all .2s;
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); font-size: 14px;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.dropzone .ic-wrap { width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 4px; }
.dropzone.has-file { border-style: solid; border-color: var(--green); background: var(--green-soft); color: var(--green-text); }

.role-options { display: grid; gap: 10px; }
.role-option {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--fill-2);
  text-align: left; transition: all .2s var(--ease); border: 1.5px solid transparent; width: 100%;
}
.role-option:hover { background: var(--fill); }
.role-option.on { border-color: var(--accent); background: var(--accent-soft); }
.role-option .ri { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.role-option .ri.need { background: var(--orange-soft); color: var(--orange); }
.role-option .ri.help { background: var(--green-soft); color: var(--green); }
.role-option .ri.member { background: var(--fill); color: var(--text-2); }
.role-option strong { display: block; font-size: 15px; }
.role-option span { font-size: 13px; color: var(--text-2); }

/* Palette de commandes */
dialog.palette { width: min(640px, calc(100vw - 32px)); margin-top: 12vh; border-radius: 18px; }
.palette .p-search { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: .5px solid var(--sep); }
.palette .p-search input { flex: 1; border: 0; outline: none; background: transparent; font-size: 19px; letter-spacing: -.015em; }
.palette .p-results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.palette .p-group { font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 10px 12px 4px; }
.palette .p-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; color: var(--text); }
.palette .p-item.sel { background: var(--accent); color: #fff; }
.palette .p-item.sel .faint, .palette .p-item.sel .muted { color: rgba(255, 255, 255, .8); }
.palette .p-item .p-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--fill); display: grid; place-items: center; color: var(--text-2); }
.palette .p-item.sel .p-ic { background: rgba(255, 255, 255, .2); color: #fff; }
.palette .p-foot { display: flex; gap: 16px; padding: 10px 20px; border-top: .5px solid var(--sep); font-size: 12px; color: var(--text-3); }
.palette kbd { font: 600 11px var(--font); background: var(--fill); border-radius: 4px; padding: 1px 5px; color: var(--text-2); }

/* Toasts */
.toasts { position: fixed; top: calc(var(--titlebar) + 14px); right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 10px; width: min(370px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 18px;
  background: var(--bg-glass); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--sh-pop); animation: toastIn .5s var(--spring) both; color: var(--text); font-size: 14px; cursor: default;
}
a.toast { cursor: pointer; }
.toast.out { animation: toastOut .3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.toast .t-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast.success .t-ic { background: var(--green); color: #fff; }
.toast.error .t-ic { background: var(--red); color: #fff; }
.toast.info .t-ic { background: var(--accent); color: #fff; }
.toast .t-body { flex: 1; min-width: 0; padding-top: 2px; }
.toast .t-title { font-weight: 650; font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
.toast .t-title small { font-weight: 500; color: var(--text-3); font-size: 11.5px; }
.toast .t-text { font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .86); z-index: 400; display: grid; place-items: center; padding: 40px; animation: fadeIn .2s; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }

/* Menu contextuel */
.menu { position: relative; display: inline-block; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; padding: 6px; border-radius: 14px; z-index: 50;
  background: var(--bg-glass); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--sh-pop); display: none; transform-origin: top right;
}
.menu.open .menu-pop { display: block; animation: menuIn .22s var(--spring); }
@keyframes menuIn { from { opacity: 0; transform: scale(.94); } }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 14px; color: var(--text); text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--accent); color: #fff; }
.menu-pop .danger { color: var(--red-text); }
.menu-pop .danger:hover { background: var(--red); color: #fff; }
.menu-pop hr { margin: 5px 6px; }

/* ------------------------------------------------------------ auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: calc(var(--titlebar) + 32px) 20px 40px; position: relative; overflow: hidden; }
.auth-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.auth-bg i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.auth-bg i:nth-child(1) { width: 520px; height: 520px; background: #8ec5ff; left: -120px; top: -160px; }
.auth-bg i:nth-child(2) { width: 460px; height: 460px; background: #c9b8ff; right: -120px; top: 20%; }
.auth-bg i:nth-child(3) { width: 420px; height: 420px; background: #a8f0d2; left: 30%; bottom: -220px; opacity: .4; }
[data-theme="dark"] .auth-bg i { opacity: .22; }
.auth-card { width: 100%; max-width: 420px; padding: 38px 36px 32px; border-radius: 28px; background: var(--bg-glass); backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%); box-shadow: var(--sh-pop); animation: modalIn .6s var(--spring) both; }
.auth-card .brand-mark { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 20px; display: block; }
.auth-card h1 { font-size: 28px; text-align: center; letter-spacing: -.028em; }
.auth-card .lead { text-align: center; font-size: 15px; margin: 6px 0 26px; }
.auth-alt { text-align: center; font-size: 14px; color: var(--text-2); margin-top: 22px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-wrap button { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border-radius: 8px; color: var(--text-3); display: grid; place-items: center; }
.pw-wrap button:hover { background: var(--fill-2); color: var(--text); }

/* ------------------------------------------------------------ onboarding */
.ob { min-height: 100vh; display: flex; flex-direction: column; padding-top: var(--titlebar); }
.ob-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 32px; }
.ob-progress { flex: 1; max-width: 280px; height: 4px; border-radius: 2px; background: var(--fill); margin: 0 24px; overflow: hidden; }
.ob-progress i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .6s var(--ease); }
.ob-main { flex: 1; display: flex; justify-content: center; padding: 20px 24px 140px; }
.ob-step { width: 100%; max-width: 760px; animation: stepIn .55s var(--ease) both; }
@keyframes stepIn { from { opacity: 0; transform: translateX(24px); } }
.ob-step.back { animation-name: stepBack; }
@keyframes stepBack { from { opacity: 0; transform: translateX(-24px); } }
.ob-step h1 { font-size: 40px; font-weight: 700; letter-spacing: -.032em; text-align: center; }
.ob-step .lead { text-align: center; margin: 10px auto 34px; max-width: 520px; }
.ob-foot {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 18px 32px 26px; display: flex; justify-content: center; gap: 12px;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}
.ob-foot .inner { width: 100%; max-width: 760px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pick {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--bg-elev); box-shadow: var(--sh-1);
  text-align: left; transition: all .25s var(--ease); border: 1.5px solid transparent; position: relative;
}
.pick:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.pick.on { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.pick .nm { font-weight: 650; font-size: 14.5px; letter-spacing: -.012em; line-height: 1.25; }
.pick .fn { font-size: 12.5px; color: var(--text-2); line-height: 1.3; margin-top: 2px; }
.pick .check { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: none; place-items: center; }
.pick.on .check { display: grid; animation: pop .35s var(--spring); }
.pick.need.on { border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.pick.need.on .check { background: var(--orange); }
.pick.help.on { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.pick.help.on .check { background: var(--green); }
.pick.disabled { opacity: .4; pointer-events: none; }
.big-seg { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.big-seg button {
  width: 150px; padding: 22px 12px; border-radius: 20px; background: var(--bg-elev); box-shadow: var(--sh-1); border: 1.5px solid transparent;
  font-size: 15px; font-weight: 600; transition: all .25s var(--ease);
}
.big-seg button strong { display: block; font-family: var(--font-display); font-size: 34px; letter-spacing: -.03em; margin-bottom: 2px; }
.big-seg button.on { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--accent-text); }
.ob-card { padding: 22px 24px; margin-top: 18px; }
.ob-summary .tile { margin-right: 4px; }

/* ------------------------------------------------------------ landing */
.landing { background: var(--bg); }
.lnav {
  position: sticky; top: var(--titlebar); z-index: 50; height: 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1120px) / 2)); background: var(--bg-glass); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--sep);
}
.lnav .brand { padding: 0; }
.lnav .links { display: flex; gap: 6px; align-items: center; }
.lhero { text-align: center; padding: 92px 24px 40px; max-width: 980px; margin: 0 auto; }
.lhero .tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; background: var(--bg-elev); box-shadow: var(--sh-1); font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 26px; }
.lhero .tag .pill { height: 20px; }
.lhero h1 { font-size: clamp(44px, 7.2vw, 84px); font-weight: 750; letter-spacing: -.045em; line-height: 1.02; }
.grad-text { background: linear-gradient(100deg, #0071e3 10%, #6e3ff2 55%, #d83bd2 95%); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-theme="dark"] .grad-text { background-image: linear-gradient(100deg, #2997ff 10%, #8f6bff 55%, #ff6bd6 95%); }
.lhero .lead { font-size: clamp(18px, 2.1vw, 22px); max-width: 680px; margin: 24px auto 34px; line-height: 1.4; }
.lhero .ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.mock-wrap { max-width: 1120px; margin: 40px auto 0; padding: 0 24px; perspective: 1600px; }
.mock {
  border-radius: 18px; overflow: hidden; background: var(--bg-elev); box-shadow: 0 50px 100px -30px rgba(0, 30, 80, .35), 0 0 0 .5px var(--sep-strong);
  display: grid; grid-template-columns: 210px 1fr 250px; height: 520px; text-align: left; transform: rotateX(6deg); transform-origin: top center;
  animation: mockIn 1.2s var(--ease) .1s both;
}
@keyframes mockIn { from { opacity: 0; transform: rotateX(18deg) translateY(40px); } }
.mock-side { background: var(--sidebar); border-right: .5px solid var(--sep); padding: 14px 10px; }
.mock-dots { display: flex; gap: 7px; padding: 2px 6px 18px; }
.mock-dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.mock-dots i:nth-child(2) { background: #febc2e; } .mock-dots i:nth-child(3) { background: #28c840; }
.mock-side .nav-item { font-size: 12.5px; min-height: 30px; }
.mock-main { display: flex; flex-direction: column; min-width: 0; }
.mock-main .group-head { padding: 12px 18px; }
.mock-main .group-head h1 { font-size: 15px; }
.mock-chat { flex: 1; padding: 10px 20px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.mock-chat .bubble { font-size: 13px; padding: 7px 12px; }
.mock-chat .msg .avatar { --s: 26px; }
.mock-panel { border-left: .5px solid var(--sep); padding: 18px 16px; background: var(--bg-elev-2); }
.mock-composer { margin: 0 18px 16px; height: 40px; border-radius: 20px; box-shadow: 0 0 0 .5px var(--sep-strong); display: flex; align-items: center; padding: 0 6px 0 16px; color: var(--text-3); font-size: 13px; justify-content: space-between; }
.lsection { max-width: 1120px; margin: 0 auto; padding: 120px 24px 0; }
.lsection h2 { font-size: clamp(34px, 4.6vw, 54px); font-weight: 750; letter-spacing: -.04em; text-align: center; line-height: 1.05; }
.lsection > .lead { text-align: center; max-width: 640px; margin: 18px auto 52px; font-size: 19px; }
.feat { padding: 30px; border-radius: 28px; }
.feat .f-ic { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: #fff; margin-bottom: 20px; }
.feat h3 { font-size: 22px; letter-spacing: -.025em; margin-bottom: 8px; }
.feat p { color: var(--text-2); font-size: 15.5px; line-height: 1.5; }
.feat-wide { grid-column: 1 / -1; display: flex; align-items: center; gap: 24px; }
.feat-wide .f-ic { margin: 0; flex-shrink: 0; }
.feat-big { grid-column: span 2; display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: center; }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.step-card { padding: 26px; border-radius: 24px; }
.step-card .n { width: 34px; height: 34px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: 15px; margin-bottom: 18px; }
.step-card h4 { font-size: 17px; margin-bottom: 6px; }
.step-card p { color: var(--text-2); font-size: 14.5px; }
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); margin-top: 10px; }
.marquee-track { display: flex; gap: 10px; width: max-content; animation: marquee 50s linear infinite; padding: 6px 0; }
.marquee-track .chip { height: 40px; padding: 0 16px 0 6px; font-size: 14px; background: var(--bg-elev); box-shadow: var(--sh-1); }
.marquee-track .chip .tile { width: 28px; height: 28px; font-size: 10px; border-radius: 8px; }
@keyframes marquee { to { transform: translateX(-50%); } }
.lcta { margin: 120px auto 0; max-width: 1072px; border-radius: 34px; padding: 70px 30px; text-align: center; color: #fff; position: relative; overflow: hidden; background: linear-gradient(135deg, #0071e3, #5e3df0 60%, #b13fe0); }
.lcta h2 { color: #fff; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.04em; }
.lcta p { color: rgba(255, 255, 255, .85); font-size: 18px; margin: 14px auto 30px; max-width: 520px; }
.lcta .btn { background: #fff; color: #1d1d1f; }
.lfoot { max-width: 1120px; margin: 0 auto; padding: 50px 24px 60px; display: flex; justify-content: space-between; gap: 20px; color: var(--text-3); font-size: 13px; flex-wrap: wrap; }

/* ------------------------------------------------------------ admin */
.admin-nav { display: flex; gap: 4px; margin-bottom: 30px; flex-wrap: wrap; padding: 4px; background: var(--fill-2); border-radius: 14px; width: fit-content; }
.admin-nav a { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 10px; font-size: 13.5px; font-weight: 550; color: var(--text-2); }
.admin-nav a:hover { color: var(--text); }
.admin-nav a.on { background: var(--bg-elev); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, .06), 0 0 0 .5px rgba(0, 0, 0, .04); }
.admin-nav a .ic { color: var(--accent); }
.table-wrap { background: var(--bg-elev); border-radius: var(--r-l); box-shadow: var(--sh-1); overflow: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3); padding: 12px 16px; border-bottom: .5px solid var(--sep); white-space: nowrap; background: var(--bg-elev-2); position: sticky; top: 0; }
.table td { padding: 11px 16px; border-bottom: .5px solid var(--sep); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--fill-2); }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .b i { width: 100%; max-width: 26px; border-radius: 6px 6px 3px 3px; background: linear-gradient(to top, var(--accent), #5ac8fa); min-height: 3px; transition: height .8s var(--ease); }
.bars.purple .b i { background: linear-gradient(to top, #5856d6, #af52de); }
.bars .b span { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; }
.setting-row + .setting-row { border-top: .5px solid var(--sep); }
.setting-row .grow { flex: 1; min-width: 0; }
.setting-row .title { font-weight: 600; font-size: 15px; }
.setting-row .desc { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mode-card { padding: 22px; border-radius: 22px; background: var(--bg-elev); box-shadow: var(--sh-1); text-align: left; border: 2px solid transparent; transition: all .25s var(--ease); display: flex; flex-direction: column; gap: 10px; }
.mode-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.mode-card.on { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.mode-card .mi { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; }
.mode-card strong { font-size: 16px; letter-spacing: -.015em; }
.mode-card span { font-size: 13.5px; color: var(--text-2); }
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }

/* ------------------------------------------------------------ divers */
.error-page { min-height: calc(100vh - var(--titlebar)); display: grid; place-items: center; text-align: center; padding: 40px; }
.error-page .code { font-family: var(--font-display); font-size: 110px; font-weight: 800; letter-spacing: -.06em; line-height: 1; }
.skeleton { background: linear-gradient(90deg, var(--fill-2), var(--fill), var(--fill-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.flex { display: flex; } .items-center { align-items: center; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .chat-side { display: none; }
  .split { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .mock { grid-template-columns: 190px 1fr; }
  .mock-panel { display: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { height: calc(100vh - 64px); }
  .page { padding: 24px 18px 90px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 64px; z-index: 80; justify-content: space-around; align-items: flex-start; padding-top: 6px;
    background: var(--bg-glass); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); border-top: .5px solid var(--sep-strong);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--text-3); position: relative; min-width: 60px; }
  .tabbar a.active { color: var(--accent); }
  .tabbar .badge { position: absolute; top: -4px; left: 50%; margin-left: 4px; height: 17px; min-width: 17px; font-size: 10px; padding: 0 4px; }
  .grid-3, .grid-4, .mode-cards, .steps { grid-template-columns: 1fr; }
  .feat-big { grid-column: auto; grid-template-columns: 1fr; }
  .feat-wide { flex-direction: column; align-items: flex-start; }
  .feat-wide .btn { margin-left: 0 !important; }
  .dm-layout { grid-template-columns: 1fr; height: calc(100vh - 64px); }
  .dm-layout.has-active .dm-list { display: none; }
  .dm-layout:not(.has-active) .dm-pane { display: none; }
  .group-head { padding: 12px 16px; flex-wrap: wrap; gap: 10px 12px; }
  .group-head .tile-l { --s: 44px; }
  .group-head .info { flex: 1 1 0; }
  .group-head h1 { font-size: 17px; }
  .group-head .sub > a, .group-head .sub > .sep:first-of-type { display: none; }
  .group-head [data-role-seg] { order: 5; width: 100%; display: flex; }
  .group-head [data-role-seg] > * { flex: 1; justify-content: center; padding: 0 6px; font-size: 12px; }
  .group-tabs { overflow-x: auto; padding: 0 8px; }
  .group-tabs button { padding: 0 10px; flex-shrink: 0; }
  .chat-scroll { padding: 12px 12px 6px; }
  .composer-wrap { padding: 6px 10px 12px; }
  .kv { grid-template-columns: repeat(2, 1fr); }
  .profile-hero { flex-direction: column; text-align: center; }
  .title-xl { font-size: 28px; }
  .mock { grid-template-columns: 1fr; height: 440px; }
  .mock-side { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .msg .stack { max-width: 84%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
