:root {
    --bg: #f8faff;
    --surface: #ffffff;
    --surface-soft: #f4f6ff;
    --line: #e5ebf6;
    --line-strong: #dbe3f2;
    --text: #101735;
    --muted: #66718f;
    --muted-strong: #465373;
    --primary: #5862ff;
    --primary-strong: #3944e7;
    --primary-soft: #eef0ff;
    --green: #13a05f;
    --green-soft: #e8f8ef;
    --blue: #2567ff;
    --blue-soft: #eaf1ff;
    --purple: #6557ff;
    --purple-soft: #f0eeff;
    --orange: #d98216;
    --orange-soft: #fff2df;
    --amber: #c98212;
    --amber-soft: #fff5df;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --shadow: 0 18px 42px rgba(36, 50, 105, 0.08);
    --shadow-soft: 0 10px 26px rgba(36, 50, 105, 0.06);
    --radius: 8px;
    --radius-lg: 12px;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 78% 4%, rgba(88, 98, 255, 0.07), transparent 26rem),
        linear-gradient(180deg, #fbfcff 0%, var(--bg) 46%, #ffffff 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg {
    display: block;
}

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon,
.section-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-shell {
    display: grid;
    grid-template-columns: 266px minmax(0, 1fr) 330px;
    grid-template-rows: 80px minmax(0, 1fr);
    min-height: 100vh;
}

.app-shell--without-right-rail {
    grid-template-columns: 266px minmax(0, 1fr);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 266px minmax(360px, 544px) minmax(320px, 1fr);
    align-items: center;
    gap: 24px;
    height: 80px;
    padding: 0 22px 0 18px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.brand-block {
    display: flex;
    align-items: center;
    min-width: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-logo {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: var(--primary);
    background: #ffffff;
    border: 1px solid #dbe0ff;
    border-radius: 8px;
    box-shadow: inset 0 0 0 2px rgba(88, 98, 255, 0.08), 0 8px 22px rgba(88, 98, 255, 0.14);
}

.brand-logo .icon {
    width: 28px;
    height: 28px;
}

.brand strong {
    display: block;
    color: #081129;
    font-size: 22px;
    line-height: 1.1;
    letter-spacing: 0;
}

.brand small {
    display: block;
    margin-top: 4px;
    color: #62708d;
    font-size: 13px;
    white-space: nowrap;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 10px;
    color: var(--muted-strong);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.searchbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    height: 44px;
    padding: 0 10px 0 16px;
    color: #526180;
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 24px rgba(32, 46, 90, 0.05);
}

.searchbar .icon {
    width: 20px;
    height: 20px;
}

.searchbar input {
    min-width: 0;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
}

.searchbar input::placeholder {
    color: #65718e;
    opacity: 1;
}

.shortcut-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 30px;
    padding: 0 8px;
    color: #61708f;
    background: #f8faff;
    border: 1px solid var(--line);
    border-radius: 7px;
    cursor: pointer;
}

.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    min-width: 0;
}

.dashboard-link,
.icon-button,
.profile-button,
.auth-link {
    color: #2f3c5f;
}

.dashboard-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    white-space: nowrap;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
}

.profile-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    cursor: pointer;
}

.profile-menu {
    position: relative;
    flex: 0 0 auto;
}

.profile-button .profile-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #1723a9;
    font-weight: 800;
    background: var(--primary-soft);
    border-radius: 50%;
}

.profile-button strong {
    max-width: 138px;
    overflow: hidden;
    color: #17213d;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 80;
    display: none;
    min-width: 220px;
    padding: 10px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.profile-menu.is-open .profile-popover {
    display: grid;
    gap: 8px;
}

.profile-email {
    overflow: hidden;
    padding: 8px 10px;
    color: #66718f;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-popover button,
.auth-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    font-weight: 800;
    border-radius: var(--radius);
}

.profile-popover button {
    width: 100%;
    color: #34405f;
    background: #f8faff;
    border: 1px solid var(--line);
    cursor: pointer;
}

.auth-link {
    white-space: nowrap;
}

.auth-link-primary {
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 10px 22px rgba(88, 98, 255, 0.18);
}

.auth-link.auth-link-primary:hover {
    color: #ffffff;
    background: var(--primary-strong);
}

.sidebar {
    position: sticky;
    top: 80px;
    z-index: 35;
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    padding: 30px 18px 18px;
    background: rgba(255, 255, 255, 0.86);
    border-right: 1px solid var(--line);
}

.new-debate-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 46px;
    color: #ffffff;
    font-weight: 800;
    background: linear-gradient(135deg, #4e6bff 0%, #7358ff 100%);
    border-radius: var(--radius);
    box-shadow: 0 14px 28px rgba(88, 98, 255, 0.25);
    cursor: pointer;
}

.primary-nav {
    display: grid;
    gap: 6px;
    margin-top: 24px;
}

.nav-item,
.theme-pill {
    display: flex;
    align-items: center;
    min-width: 0;
    color: #182443;
    font-weight: 700;
}

.nav-item {
    gap: 14px;
    height: 44px;
    padding: 0 14px;
    border-radius: var(--radius);
}

.nav-item .icon,
.theme-pill .icon {
    color: #647292;
}

.nav-item.is-active {
    color: #2432bf;
    background: linear-gradient(90deg, #eef1ff 0%, rgba(246, 247, 255, 0.5) 100%);
}

.nav-item.is-active .icon {
    color: var(--primary);
}

.theme-nav {
    margin-top: 54px;
}

.theme-nav h2 {
    margin: 0 0 14px;
    color: #66718f;
    font-size: 12px;
    line-height: 1;
    text-transform: uppercase;
}

.theme-list {
    display: grid;
    gap: 8px;
}

.theme-pill {
    gap: 12px;
    height: 40px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.sidebar-footer {
    display: grid;
    gap: 8px;
    margin-top: auto;
    padding: 22px 4px 0;
    color: #697693;
    border-top: 1px solid rgba(229, 235, 246, 0.8);
}

.sidebar-footer strong {
    color: #56617e;
    font-weight: 600;
}

.sidebar-footer a,
.sidebar-footer span {
    font-size: 12px;
}

.page-content {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    padding: 20px 32px 16px;
}

.welcome-panel {
    position: relative;
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 190px;
    gap: 18px;
    min-height: 146px;
    overflow: hidden;
    padding: 22px 24px;
    background:
        radial-gradient(circle at 98% 10%, rgba(115, 88, 255, 0.14), transparent 15rem),
        linear-gradient(135deg, #ffffff 0%, #ffffff 62%, #f5f4ff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.welcome-panel::after {
    position: absolute;
    inset: auto 68px -92px auto;
    width: 330px;
    height: 220px;
    content: "";
    border: 1px solid rgba(207, 213, 246, 0.8);
    border-radius: 50%;
    transform: rotate(-25deg);
}

.welcome-emoji {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    font-size: 38px;
    background: linear-gradient(180deg, #f7f8ff 0%, #eef1ff 100%);
    border-radius: 50%;
}

.welcome-content {
    min-width: 0;
}

.welcome-content h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    letter-spacing: 0;
}

.welcome-content p {
    margin: 8px 0 14px;
    color: #485574;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(138px, 1fr));
    gap: 22px;
    max-width: 560px;
}

.stat-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 10px;
    min-height: 52px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.stat-icon {
    display: grid;
    grid-row: 1 / 3;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 50%;
}

.stat-card strong {
    font-size: 18px;
    line-height: 1.1;
}

.stat-card span:not(.stat-icon) {
    color: #66718f;
    font-size: 12px;
}

.welcome-art {
    position: relative;
    min-width: 160px;
}

.chat-bubble {
    position: absolute;
    right: 22px;
    top: 18px;
    display: grid;
    gap: 9px;
    width: 78px;
    height: 58px;
    padding: 17px 17px 0;
    background: linear-gradient(135deg, #bfc4ff 0%, #aeb5ff 100%);
    border-radius: 29px 29px 29px 8px;
    box-shadow: 0 16px 34px rgba(88, 98, 255, 0.22);
}

.chat-bubble span {
    display: block;
    height: 4px;
    background: rgba(255, 255, 255, 0.82);
    border-radius: 999px;
}

.chat-bubble span:last-child {
    width: 70%;
}

.welcome-art i {
    position: absolute;
    display: block;
    width: 9px;
    height: 9px;
    background: rgba(255, 255, 255, 0.9);
    clip-path: polygon(50% 0, 64% 36%, 100% 50%, 64% 64%, 50% 100%, 36% 64%, 0 50%, 36% 36%);
}

.welcome-art i:nth-child(2) {
    top: 34px;
    left: 12px;
}

.welcome-art i:nth-child(3) {
    top: 12px;
    left: 54px;
}

.welcome-art i:nth-child(4) {
    bottom: 22px;
    left: 38px;
}

.content-section {
    margin-top: 16px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 32px;
}

.section-heading h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: 0;
}

.section-icon {
    color: #d98216;
}

.section-link {
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

.debate-grid,
.premium-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.debate-grid {
    margin-top: 8px;
}

.debate-card,
.premium-card,
.feature-card,
.metric-card,
.mini-panel,
.recommendation-panel,
.mediator-panel,
.category-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.debate-card {
    position: relative;
    min-height: 184px;
    overflow: hidden;
    padding: 12px 12px 44px;
}

.debate-card::before,
.premium-card::before {
    position: absolute;
    inset: 0;
    content: "";
    pointer-events: none;
    background:
        radial-gradient(circle at 68% 22%, rgba(88, 98, 255, 0.14), transparent 0.18rem),
        radial-gradient(circle at 87% 12%, rgba(88, 98, 255, 0.08), transparent 0.16rem);
}

.debate-copy {
    position: relative;
    z-index: 1;
    max-width: 61%;
    min-width: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    border-radius: 7px;
}

.badge-green {
    color: #0a8d4f;
    background: var(--green-soft);
}

.badge-blue {
    color: var(--blue);
    background: var(--blue-soft);
}

.badge-purple {
    color: var(--purple);
    background: var(--purple-soft);
}

.badge-orange {
    color: var(--orange);
    background: var(--orange-soft);
}

.debate-card h3,
.premium-card h3,
.recommendation-item strong,
.feature-card h3 {
    color: #101735;
    letter-spacing: 0;
}

.debate-card h3 {
    margin: 10px 0 7px;
    font-size: 14px;
    line-height: 1.22;
}

.debate-card p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: #33405f;
    font-size: 11px;
    line-height: 1.38;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.debate-sides {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 18px;
    color: #4f5c7a;
    font-size: 10px;
    font-weight: 700;
}

.debate-sides span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.debate-sides .icon {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.debate-sides strong {
    color: #77829b;
    font-size: 9px;
}

.debate-illustration {
    position: absolute;
    top: 0px;
    right: 0px;
    z-index: 0;
    width: 70%;
    max-width: 219px;
    height: 175px;
    object-fit: contain;
    object-position: right center;
}

.card-footer {
    position: absolute;
    right: 12px;
    bottom: 10px;
    left: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: #5f6b88;
    font-size: 10px;
    font-weight: 700;
}

.card-footer span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.card-footer .icon {
    width: 14px;
    height: 14px;
}

.trust {
    color: var(--green);
}

.open-button,
.premium-footer button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    height: 26px;
    margin-left: auto;
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    background: #ffffff;
    border: 1px solid #dce3ff;
    border-radius: 7px;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(88, 98, 255, 0.07);
}

.premium-section {
    margin-top: 14px;
}

.premium-grid {
    margin-top: 8px;
}

.premium-card {
    position: relative;
    min-height: 154px;
    overflow: hidden;
    padding: 12px 12px 42px;
    border-color: #ffd9a3;
    background:
        radial-gradient(circle at 75% 28%, rgba(255, 196, 113, 0.16), transparent 7rem),
        #ffffff;
}

.premium-copy {
    position: relative;
    z-index: 1;
    max-width: 62%;
}

.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 22px;
    padding: 4px 9px;
    color: #f08016;
    font-size: 11px;
    font-weight: 800;
    background: var(--orange-soft);
    border-radius: 7px;
}

.premium-badge .icon {
    width: 14px;
    height: 14px;
}

.premium-card h3 {
    margin: 10px 0 7px;
    font-size: 15px;
    line-height: 1.18;
}

.premium-card p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: #33405f;
    font-size: 11px;
    line-height: 1.38;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.premium-illustration {
    position: absolute;
    top: 22px;
    right: 7px;
    width: 45%;
    max-width: 176px;
    height: 94px;
    object-fit: contain;
    object-position: right center;
}

.premium-footer {
    position: absolute;
    right: 12px;
    bottom: 10px;
    left: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #77829b;
    font-size: 10px;
}

.premium-footer strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: #273453;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.premium-footer strong .icon {
    width: 18px;
    height: 18px;
}

.premium-footer button {
    min-width: 72px;
    background: #f4f1ff;
    border-color: transparent;
}

.categories-section {
    margin-top: 12px;
}

.category-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(118px, 1fr)) 42px;
    gap: 14px;
    margin-top: 8px;
}

.category-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    height: 52px;
    padding: 9px 12px;
}

.category-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.category-purple {
    color: var(--purple);
    background: var(--purple-soft);
}

.category-green {
    color: var(--green);
    background: var(--green-soft);
}

.category-amber {
    color: var(--amber);
    background: var(--amber-soft);
}

.category-blue {
    color: var(--blue);
    background: var(--blue-soft);
}

.category-card span:last-child {
    display: grid;
    min-width: 0;
}

.category-card strong {
    overflow: hidden;
    color: #17213d;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-card small {
    color: #65718e;
    font-size: 11px;
}

.round-next {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    align-self: center;
    color: #101735;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 50%;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}

.right-rail {
    grid-column: 3;
    grid-row: 2;
    min-width: 0;
    padding: 20px 22px 16px 0;
}

.rail-panel {
    display: grid;
    gap: 14px;
    padding: 18px 12px 12px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.rail-panel h2 {
    margin: 0 0 2px 12px;
    font-size: 18px;
    letter-spacing: 0;
}

.feature-card,
.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 142px;
    padding: 16px;
}

.eyebrow {
    display: block;
    color: #17213d;
    font-size: 12px;
    font-weight: 800;
}

.feature-card .badge {
    margin-top: 12px;
}

.feature-card h3 {
    max-width: 220px;
    margin: 11px 0 8px;
    font-size: 14px;
    line-height: 1.25;
}

.feature-card p {
    margin: 0;
    color: #596681;
    font-weight: 600;
}

.feature-orb {
    position: absolute;
    right: 24px;
    top: 58px;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    color: var(--green);
    background: #dcf6e8;
    border-radius: 50%;
}

.feature-orb .icon {
    width: 24px;
    height: 24px;
}

.metric-card {
    min-height: 140px;
}

.metric-card strong {
    display: block;
    margin-top: 16px;
    color: var(--green);
    font-size: 26px;
    line-height: 1;
}

.metric-card span:not(.eyebrow) {
    display: block;
    margin-top: 6px;
    color: #66718f;
    font-weight: 600;
}

.metric-card small {
    display: block;
    margin-top: 18px;
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
}

.metric-line {
    position: absolute;
    right: 10px;
    bottom: 26px;
    width: 156px;
    height: 74px;
    overflow: visible;
}

.metric-line path {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
    filter: drop-shadow(0 10px 14px rgba(88, 98, 255, 0.16));
}

.metric-line circle {
    fill: var(--primary);
}

.mini-panel {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 92px;
    padding: 16px;
}

.premium-token {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: #c97910;
    background: var(--orange-soft);
    border-radius: 50%;
}

.mini-panel strong {
    display: block;
    margin-top: 4px;
    font-size: 22px;
    line-height: 1;
}

.mini-panel p {
    margin: 5px 0 0;
    color: #66718f;
}

.mini-panel > a {
    color: #526180;
}

.recommendation-panel {
    padding: 14px 16px 4px;
}

.recommendation-panel h3 {
    margin: 0 0 8px;
    font-size: 13px;
}

.recommendation-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 10px;
    min-height: 74px;
    border-top: 1px solid var(--line);
}

.recommendation-item:first-of-type {
    border-top: 0;
}

.recommendation-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.recommendation-item span:nth-child(2) {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.recommendation-item .badge {
    width: fit-content;
    min-height: 20px;
    padding: 4px 8px;
    font-size: 10px;
}

.recommendation-item strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.recommendation-item small {
    color: #65718e;
    font-weight: 700;
}

.mediator-panel {
    position: relative;
    min-height: 158px;
    padding: 18px 18px 16px;
    background:
        radial-gradient(circle at 22px 22px, rgba(88, 98, 255, 0.12), transparent 2.8rem),
        linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
}

.mediator-panel > span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: var(--primary);
    vertical-align: middle;
}

.mediator-panel h3 {
    display: inline-block;
    margin: 0 0 0 8px;
    font-size: 14px;
}

.mediator-panel p {
    margin: 12px 0 14px;
    color: #24304f;
    line-height: 1.55;
}

.mediator-panel a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary);
    font-weight: 800;
}

.mediator-panel a .icon {
    width: 16px;
    height: 16px;
}

.is-hidden {
    display: none !important;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 80;
    max-width: min(360px, calc(100vw - 32px));
    padding: 12px 14px;
    color: #ffffff;
    font-weight: 700;
    background: #17213d;
    border-radius: var(--radius);
    box-shadow: 0 18px 40px rgba(16, 23, 53, 0.22);
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (hover: hover) {
    .nav-item,
    .theme-pill,
    .dashboard-link,
    .profile-button,
    .auth-link,
    .category-card,
    .recommendation-item,
    .section-link,
    .mediator-panel a {
        transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
    }

    .debate-card,
    .premium-card,
    .feature-card,
    .metric-card,
    .mini-panel,
    .category-card {
        transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
    }

    .nav-item:hover,
    .theme-pill:hover,
    .category-card:hover,
    .recommendation-item:hover {
        color: var(--primary);
    }

    .debate-card:hover,
    .premium-card:hover,
    .category-card:hover {
        border-color: #cfd7ff;
        box-shadow: var(--shadow);
        transform: translateY(-2px);
    }

    .icon-button:hover,
    .shortcut-key:hover,
    .profile-popover button:hover,
    .auth-link:hover,
    .open-button:hover,
    .premium-footer button:hover,
    .round-next:hover {
        background: var(--primary-soft);
    }
}

@media (max-width: 1420px) {
    .app-shell {
        grid-template-columns: 246px minmax(0, 1fr) 306px;
    }

    .app-shell--without-right-rail {
        grid-template-columns: 246px minmax(0, 1fr);
    }

    .topbar {
        grid-template-columns: 246px minmax(320px, 500px) minmax(280px, 1fr);
    }

    .page-content {
        padding-inline: 24px;
    }

    .debate-grid,
    .premium-grid {
        gap: 10px;
    }

    .card-footer {
        gap: 8px;
    }
}

@media (max-width: 1220px) {
    .app-shell {
        grid-template-columns: 240px minmax(0, 1fr);
        grid-template-rows: 80px auto auto;
    }

    .topbar {
        grid-template-columns: 240px minmax(280px, 1fr) auto;
    }

    .right-rail {
        grid-column: 2;
        grid-row: 3;
        padding: 0 24px 24px;
    }

    .rail-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }

    .rail-panel h2,
    .headline-panel h2 {
        grid-column: 1 / -1;
    }

    .mediator-panel {
        grid-column: 1 / -1;
    }

    .dashboard-link span {
        display: none;
    }
}

@media (max-width: 1020px) {
    .debate-grid,
    .premium-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .welcome-panel {
        grid-template-columns: 70px minmax(0, 1fr);
    }

    .welcome-art {
        display: none;
    }

    .category-row {
        display: flex;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .category-card {
        flex: 0 0 160px;
    }

    .round-next {
        flex: 0 0 42px;
    }
}

@media (max-width: 860px) {
    .app-shell {
        display: block;
    }

    .topbar {
        position: sticky;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        height: auto;
        min-height: 80px;
        gap: 12px;
        padding: 12px 16px;
    }

    .brand-block {
        min-width: 0;
    }

    .brand strong {
        font-size: 19px;
    }

    .brand small,
    .dashboard-link {
        display: none;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .searchbar {
        grid-column: 1 / -1;
        order: 3;
    }

    .shortcut-key {
        display: none;
    }

    .top-actions {
        justify-content: flex-end;
        gap: 6px;
    }

    .icon-button {
        width: 36px;
        height: 36px;
    }

    .profile-button .profile-avatar {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }

    .profile-button strong,
    .auth-link-primary {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 70;
        width: min(280px, calc(100vw - 42px));
        height: 100vh;
        padding-top: 86px;
        transform: translateX(-105%);
        box-shadow: 26px 0 60px rgba(16, 23, 53, 0.22);
        transition: transform 180ms ease;
    }

    .app-shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .app-shell.sidebar-open::after {
        position: fixed;
        inset: 0;
        z-index: 60;
        content: "";
        background: rgba(16, 23, 53, 0.36);
    }

    .page-content,
    .right-rail {
        padding: 18px 16px;
    }

    .welcome-panel {
        grid-template-columns: 58px minmax(0, 1fr);
        gap: 14px;
        padding: 18px;
    }

    .welcome-emoji {
        width: 56px;
        height: 56px;
        font-size: 30px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .stat-card {
        grid-template-columns: 1fr;
        justify-items: start;
        padding: 10px;
    }

    .stat-icon {
        grid-row: auto;
        width: 30px;
        height: 30px;
        margin-bottom: 6px;
    }

    .rail-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 660px) {
    .debate-grid,
    .premium-grid {
        grid-template-columns: 1fr;
    }

    .welcome-panel {
        display: block;
    }

    .welcome-emoji {
        margin-bottom: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        grid-template-columns: 36px minmax(0, 1fr);
        justify-items: stretch;
    }

    .stat-icon {
        grid-row: 1 / 3;
        margin-bottom: 0;
    }

    .debate-copy,
    .premium-copy {
        max-width: 64%;
    }

    .card-footer {
        flex-wrap: wrap;
    }

    .open-button {
        min-width: 100%;
        margin-left: 0;
    }

    .debate-card {
        min-height: 214px;
    }

    .premium-card {
        min-height: 178px;
    }

    .premium-footer {
        flex-wrap: wrap;
    }

    .premium-footer button {
        margin-left: 0;
    }
}

@media (max-width: 460px) {
    .topbar {
        grid-template-columns: minmax(0, 1fr);
    }

    .top-actions {
        grid-row: 1;
        justify-self: end;
    }

    .brand-block {
        grid-row: 1;
        padding-right: 132px;
    }

    .brand-logo {
        width: 36px;
        height: 36px;
    }

    .brand strong {
        overflow: hidden;
        max-width: 118px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .debate-copy,
    .premium-copy {
        max-width: 100%;
    }

    .debate-illustration,
    .premium-illustration {
        opacity: 0.22;
        right: -12px;
        width: 52%;
    }

    .metric-line {
        width: 130px;
        opacity: 0.8;
    }
}

/* Debate room */
.debate-shell {
    --composer-dock-left: calc(276px + 34px);
    --composer-dock-right: calc(330px + 34px);
    grid-template-columns: 276px minmax(0, 1fr) 330px;
}

.debate-content {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    padding: 32px 34px var(--debate-content-bottom, 16px);
}

.debate-content--with-composer {
    --debate-content-bottom: 146px;
}

.debate-summary {
    grid-column: 3;
    grid-row: 2;
    min-width: 0;
    padding: 26px 22px 16px 0;
}

.debate-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.debate-header h1,
.create-hero h1 {
    margin: 0;
    color: #111936;
    font-size: 18px;
    line-height: 1.25;
    letter-spacing: 0;
}

.debate-header p {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 0;
    color: #66718f;
    font-weight: 600;
}

.debate-header p .icon {
    width: 15px;
    height: 15px;
}

.debate-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.outline-button,
.icon-button.framed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    color: #34405f;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}

.outline-button {
    gap: 8px;
    padding: 0 14px;
    font-weight: 800;
}

.icon-button.framed {
    width: 38px;
}

.debate-options {
    position: relative;
}

.debate-options-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 85;
    min-width: 220px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.debate-options-menu[hidden] {
    display: none;
}

.danger-menu-item,
.menu-note {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border-radius: var(--radius);
    font-weight: 800;
    text-align: left;
}

.danger-menu-item {
    color: #b42318;
    background: transparent;
    cursor: pointer;
}

.danger-menu-item:hover,
.danger-menu-item:focus {
    background: #fff1f0;
    outline: 0;
}

.menu-note {
    color: #66718f;
    font-size: 12px;
    line-height: 1.35;
}

/* --- Lien de partage (menu burger) --- */
.share-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius);
    color: var(--primary);
    background: transparent;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.share-menu-item:hover,
.share-menu-item:focus {
    background: var(--primary-soft);
    outline: 0;
}

.share-menu-item .icon {
    width: 18px;
    height: 18px;
}

.share-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin: 6px 4px 8px;
}

.share-result[hidden] {
    display: none;
}

.share-result input {
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 12px;
    color: #34405f;
    background: #f7f8ff;
}

.share-copy-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--primary);
    background: var(--primary-soft);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

.share-copy-button:hover {
    background: #e2e6ff;
}

.share-copy-button .icon {
    width: 16px;
    height: 16px;
}

.share-hint {
    grid-column: 1 / -1;
    margin: 0;
    color: #66718f;
    font-size: 11px;
    line-height: 1.35;
}

/* --- Modale de partage --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(20, 27, 56, 0.55);
    backdrop-filter: blur(3px);
}

.modal-overlay[hidden] {
    display: none;
}

.modal-card {
    width: min(480px, 100%);
    padding: 22px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(20, 27, 56, 0.35);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-head h2 {
    margin: 0;
    font-size: 18px;
    color: #16213d;
}

.modal-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    color: #8a94ab;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.modal-close:hover {
    background: #f1f3fb;
    color: #16213d;
}

.modal-close .icon {
    width: 22px;
    height: 22px;
}

.modal-text {
    margin: 10px 0 16px;
    color: #66718f;
    line-height: 1.45;
}

.share-copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.share-copy-row input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 13px;
    color: #34405f;
    background: #f7f8ff;
}

.share-copy-row .share-copy-button {
    width: 44px;
    height: 44px;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
}

.danger-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
}

.danger-button {
    color: #b42318;
    background: #fff1f0;
    border: 1px solid #ffd7d2;
}

.danger-button:hover {
    background: #ffe4e1;
}

.danger-button .icon {
    width: 17px;
    height: 17px;
}

.ghost-button {
    color: #34405f;
    background: #f1f3fb;
    border: 1px solid var(--line);
}

.ghost-button:hover {
    background: #e7eaf6;
}

/* --- Page publique de partage --- */
.share-shell {
    min-height: 100vh;
    background: #f5f6fb;
}

.share-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 16px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.share-brand-text {
    display: grid;
    line-height: 1.15;
}

.share-brand-text strong {
    font-size: 18px;
    color: #16213d;
}

.share-brand-text small {
    color: #8a94ab;
    font-size: 12px;
}

.share-main {
    width: min(900px, 100%);
    margin: 0 auto;
    padding: 28px 18px 64px;
}

.share-main--centered {
    display: grid;
    place-items: center;
    min-height: 60vh;
}

.share-debate-header {
    margin-bottom: 22px;
}

.share-debate-header h1 {
    margin: 12px 0 6px;
    font-size: 26px;
    color: #16213d;
}

.share-debate-header p {
    margin: 0;
    color: #66718f;
    font-weight: 600;
}

.share-debate-header p span {
    margin: 0 6px;
}

.share-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 12px;
    font-weight: 800;
}

.share-badge .icon {
    width: 15px;
    height: 15px;
}

.share-thread {
    gap: 10px;
}

.share-footer {
    margin-top: 36px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    text-align: center;
}

.share-footer p {
    margin: 0 0 14px;
    color: #66718f;
}

.share-missing {
    max-width: 420px;
    text-align: center;
}

.share-missing-icon {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 50%;
}

.share-missing-icon .icon {
    width: 26px;
    height: 26px;
}

.share-missing h1 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #16213d;
}

.share-missing p {
    margin: 0 0 18px;
    color: #66718f;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: 12px;
    color: #ffffff;
    background: var(--primary);
    font-weight: 800;
    box-shadow: var(--shadow-soft);
}

.primary-button:hover {
    background: #4751f5;
}

.message-thread {
    display: grid;
    gap: 8px;
}

.empty-thread,
.history-empty,
.history-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.empty-thread {
    display: grid;
    gap: 6px;
    padding: 18px;
    color: #53607d;
}

.empty-thread strong {
    color: #16213d;
}

.thread-row {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.participant-avatar,
.ai-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-weight: 900;
}

.avatar-purple {
    color: #4e35cc;
    background: linear-gradient(180deg, #e7dcff 0%, #cdb9ff 100%);
}

.avatar-orange {
    color: #b26109;
    background: linear-gradient(180deg, #ffe7c0 0%, #ffd49b 100%);
}

.ai-avatar {
    color: var(--primary);
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.thread-body {
    min-width: 0;
}

.thread-meta {
    display: flex;
    align-items: baseline;
    gap: 16px;
    min-height: 22px;
}

.thread-meta strong {
    color: #16213d;
    font-size: 13px;
}

.thread-meta time {
    color: #8a94ab;
    font-size: 12px;
    font-weight: 600;
}

.message-delete-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #8a94ab;
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}

.message-delete-button:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

.message-delete-button .icon {
    width: 15px;
    height: 15px;
}

.chat-message {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    width: min(860px, 100%);
    min-height: 66px;
    padding: 16px 18px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(29, 41, 83, 0.08);
}

.chat-message p {
    margin: 0;
    color: #17213d;
    font-size: 15px;
}

.is-deleted-message .chat-message {
    grid-template-columns: minmax(0, 1fr);
    min-height: 52px;
    color: #8a94ab;
    background: #f7f8fc;
    border-style: dashed;
    box-shadow: none;
}

.is-deleted-message .chat-message p {
    color: #8a94ab;
    font-style: italic;
}

/* Messages du participant qui consulte le fil : alignés à droite (style WhatsApp).
   L'interlocuteur reste à gauche, comme avant. */
.self-thread-row {
    grid-template-columns: minmax(0, 1fr) 46px;
    /* léger décalage pour démarquer nos bulles du bord */
    padding-left: 48px;
}

.self-thread-row .participant-avatar,
.self-thread-row .ai-avatar {
    grid-column: 2;
    grid-row: 1;
}

.self-thread-row .thread-body,
.self-thread-row .ai-analysis-card {
    grid-column: 1;
    grid-row: 1;
}

.self-thread-row .thread-meta {
    flex-direction: row-reverse;
}

/* La bulle utilisateur et son analyse IA se calent à droite. */
.self-thread-row .chat-message,
.self-thread-row .ai-analysis-card {
    margin-left: auto;
}

@media (max-width: 720px) {
    .self-thread-row {
        padding-left: 0;
    }
}

.truth-badge,
.score-pill,
.form-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.truth-green,
.score-pill.score-green {
    color: var(--green);
    background: var(--green-soft);
}

.truth-orange,
.score-pill.score-orange {
    color: var(--orange);
    background: var(--orange-soft);
}

.truth-pending {
    color: var(--primary);
    background: var(--primary-soft);
}

.ai-analysis-card.is-pending {
    border-style: dashed;
    background: linear-gradient(135deg, #ffffff 0%, #f4f6ff 100%);
}

.ai-analysis-card.is-pending .ai-analysis-content {
    grid-template-columns: minmax(0, 1fr);
}

.is-pending-analysis .ai-avatar {
    color: var(--primary);
    background: var(--primary-soft);
}

.ai-analysis-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(860px, 100%);
    min-height: 124px;
    padding: 16px 18px;
    background: #e8edf6;
    border: 1px solid #d2dbeb;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.ai-analysis-head {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 24px;
}

.ai-analysis-head strong {
    color: #2432bf;
    font-size: 15px;
}

.ai-analysis-head time {
    color: #8a94ab;
    font-size: 12px;
    font-weight: 600;
}

.analysis-toggle {
    margin-left: auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    color: var(--primary);
    background: var(--primary-soft);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.analysis-toggle:hover {
    background: #e2e6ff;
}

.analysis-toggle .icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.ai-analysis-card.is-collapsed .analysis-toggle .icon {
    transform: rotate(-90deg);
}

.ai-analysis-card.is-collapsed {
    min-height: 0;
}

.ai-analysis-card.is-collapsed .ai-analysis-content {
    display: none;
}

.ai-analysis-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 128px minmax(220px, 270px);
    gap: 22px;
}

.analysis-spinner {
    margin-left: auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2.5px solid var(--primary-soft);
    border-top-color: var(--primary);
    animation: analysis-spin 0.7s linear infinite;
}

@keyframes analysis-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Analyse en échec --- */
.ai-analysis-card.is-failed {
    border-color: #f3c9c4;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f4 100%);
}

.ai-analysis-card.is-failed .ai-analysis-content {
    grid-template-columns: minmax(0, 1fr);
}

.is-failed-analysis .ai-avatar {
    color: #b42318;
    background: #fff1f0;
}

.analysis-failed-badge {
    display: grid;
    place-items: center;
    margin-left: auto;
    color: #b42318;
}

.analysis-failed-badge .icon {
    width: 20px;
    height: 20px;
}

.ai-analysis-failed-copy p {
    margin: 0;
    color: #8a3b34;
}

.ai-analysis-failed-copy p:first-child {
    font-weight: 800;
    color: #b42318;
}

.ai-analysis-error-detail {
    margin-top: 4px !important;
    font-size: 12px;
    color: #9a7b78 !important;
    word-break: break-word;
}

.analysis-retry-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    min-height: 34px;
    padding: 0 14px;
    color: var(--primary);
    background: var(--primary-soft);
    border: 0;
    border-radius: 999px;
    font-weight: 800;
    cursor: pointer;
}

.analysis-retry-button:hover {
    background: #e2e6ff;
}

.analysis-retry-button .icon {
    width: 16px;
    height: 16px;
}

.ai-analysis-copy,
.ai-score {
    min-width: 0;
}

.ai-analysis-copy .thread-meta strong {
    color: #2432bf;
    font-size: 15px;
}

.ai-analysis-copy p {
    margin: 6px 0 0;
    color: #263351;
}

.ai-score,
.ai-sources {
    border-left: 1px solid #d9def0;
    padding-left: 22px;
}

.ai-score span,
.ai-sources strong {
    color: #34405f;
    font-size: 12px;
    font-weight: 800;
}

.ai-score strong {
    display: block;
    margin: 8px 0;
    font-size: 26px;
    line-height: 1;
}

.score-green {
    color: var(--green);
}

.score-orange {
    color: var(--orange);
}

.ai-score .score-pill {
    min-height: 24px;
    padding: 4px 9px;
    font-size: 11px;
}

.ai-sources ul,
.summary-list ul,
.sources-list ol {
    margin: 6px 0 0;
    padding-left: 18px;
    color: #263351;
}

.ai-sources li,
.summary-list li {
    margin-top: 3px;
}

.ai-sources a,
.sources-list a {
    display: inline-block;
    margin-top: 6px;
    color: var(--primary);
    font-weight: 800;
}

.composer-dock {
    position: fixed;
    right: var(--composer-dock-right);
    bottom: 10px;
    bottom: calc(env(safe-area-inset-bottom) + 10px);
    left: var(--composer-dock-left);
    z-index: 45;
    display: grid;
    gap: 6px;
    pointer-events: none;
}

.composer-dock > * {
    pointer-events: auto;
}

.message-composer {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto 48px;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    margin-top: 0;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 38px rgba(29, 41, 83, 0.12);
    backdrop-filter: blur(16px);
}

.composer-tool {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: #6a7590;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
}

.message-composer textarea {
    width: 100%;
    min-height: 38px;
    max-height: 120px;
    resize: vertical;
    padding: 9px 8px;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
}

.message-composer textarea::placeholder {
    color: #9aa3b8;
}

.ai-request-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    color: var(--primary);
    font-weight: 900;
    background: var(--primary-soft);
    border-radius: var(--radius);
    cursor: pointer;
}

.send-button {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #ffffff;
    background: linear-gradient(135deg, #5c6cff 0%, #6d57ff 100%);
    border-radius: 50%;
    box-shadow: 0 14px 30px rgba(88, 98, 255, 0.28);
    cursor: pointer;
}

.composer-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0 64px;
    color: #8a94ab;
    font-size: 11px;
    font-weight: 700;
}

.composer-note .icon {
    width: 14px;
    height: 14px;
}

.composer-dock .composer-note {
    margin: 0 0 0 64px;
}

.debate-shell + .toast {
    bottom: 126px;
}

.summary-panel {
    overflow: hidden;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.summary-panel h2 {
    margin: 0;
    padding: 20px 24px;
    font-size: 18px;
    border-bottom: 1px solid var(--line);
}

.summary-block,
.summary-list,
.debate-mediator-panel {
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}

.summary-block h3,
.summary-list h3 {
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
}

.consensus-block {
    text-align: center;
}

.consensus-block h3 {
    text-align: left;
}

.consensus-gauge {
    --value: 62;
    --gauge: calc(var(--value) * 1%);
    position: relative;
    display: grid;
    place-items: center;
    width: 156px;
    height: 86px;
    margin: 18px auto 4px;
    overflow: hidden;
}

.consensus-gauge-62 {
    --value: 62;
}

.consensus-gauge::before {
    position: absolute;
    inset: 0;
    content: "";
    border: 12px solid #e8ebf4;
    border-bottom: 0;
    border-radius: 156px 156px 0 0;
}

.consensus-gauge::after {
    position: absolute;
    inset: 0;
    content: "";
    border: 12px solid var(--primary);
    border-right-color: transparent;
    border-bottom: 0;
    border-radius: 156px 156px 0 0;
    transform: rotate(calc((var(--value) - 50) * 1.8deg));
    transform-origin: 50% 100%;
}

.consensus-gauge span {
    position: relative;
    z-index: 1;
    align-self: end;
    color: #121a37;
    font-size: 28px;
    font-weight: 900;
}

.consensus-block p {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    color: #34405f;
    font-weight: 800;
}

.reliability-block {
    position: relative;
    min-height: 138px;
}

.reliability-block strong {
    display: block;
    margin-top: 16px;
    color: var(--green);
    font-size: 26px;
    line-height: 1;
}

.summary-line {
    position: absolute;
    right: 20px;
    bottom: 22px;
    width: 128px;
    height: 72px;
    overflow: visible;
}

.summary-line path {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
}

.summary-line circle {
    fill: var(--primary);
}

.summary-list header {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
}

.summary-list header > span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
}

.summary-agreements header > span {
    color: var(--green);
}

.summary-disagreements header > span {
    color: var(--orange);
}

.sources-list header {
    grid-template-columns: 24px minmax(0, 1fr);
}

.sources-list ol {
    padding-left: 20px;
}

.sources-list li {
    margin-top: 7px;
}

.debate-mediator-panel {
    margin: 18px 14px;
    border: 1px solid var(--line);
}

.debate-nav .theme-nav {
    display: none;
}

.debate-list-section {
    margin-top: 34px;
}

.debate-list-section h2 {
    margin: 0 0 14px;
    color: #66718f;
    font-size: 12px;
    line-height: 1;
    text-transform: uppercase;
}

.debate-list-card {
    position: relative;
    display: grid;
    gap: 6px;
    padding: 16px 14px;
    background: linear-gradient(135deg, #f2f0ff 0%, #ffffff 100%);
    border-radius: var(--radius);
}

.debate-list-card strong,
.other-debate-list strong {
    color: #16213d;
    font-size: 13px;
}

.debate-list-card span,
.other-debate-list span {
    color: #66718f;
    font-weight: 600;
}

.debate-list-card i {
    position: absolute;
    right: 16px;
    top: 50%;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    transform: translateY(-50%);
}

.other-debate-list {
    display: grid;
    gap: 18px;
}

.other-debate-list a {
    display: grid;
    gap: 6px;
}

.view-all-debates {
    display: inline-block;
    margin-top: 20px;
    color: #34405f;
    font-weight: 700;
}

/* Debate creation */
.create-shell {
    grid-template-columns: 266px minmax(0, 1fr);
}

.create-content {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    padding: 28px 34px 36px;
}

.create-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: stretch;
    padding: 26px;
    background:
        radial-gradient(circle at 88% 18%, rgba(88, 98, 255, 0.12), transparent 16rem),
        linear-gradient(135deg, #ffffff 0%, #f6f8ff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 900;
}

.create-hero h1 {
    margin-top: 12px;
    font-size: 28px;
}

.create-hero p {
    max-width: 680px;
    margin: 10px 0 0;
    color: #53607d;
    font-size: 15px;
}

.create-guardrails {
    display: grid;
    align-content: center;
    gap: 12px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.create-guardrails span {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #2b3654;
    font-weight: 800;
}

.create-guardrails .icon {
    color: var(--green);
}

.create-debate-form {
    margin-top: 18px;
}

.create-alert,
.debate-alert {
    margin-top: 16px;
}

.debate-type-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    border: 0;
}

.debate-type-card {
    position: relative;
    display: grid;
    gap: 12px;
    min-height: 232px;
    padding: 20px;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.debate-type-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-check {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    color: #c8cfdf;
}

.option-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 50%;
}

.debate-type-card strong {
    color: #111936;
    font-size: 17px;
}

.debate-type-card > span:not(.option-check):not(.option-icon) {
    color: #53607d;
}

.debate-type-card ul {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    color: #34405f;
    list-style: none;
}

.debate-type-card li {
    position: relative;
    padding-left: 16px;
    font-size: 12px;
    font-weight: 800;
}

.debate-type-card li::before {
    position: absolute;
    top: 0.62em;
    left: 0;
    width: 6px;
    height: 6px;
    content: "";
    background: var(--primary);
    border-radius: 50%;
}

.debate-type-card:has(input:checked) {
    border-color: #aeb6ff;
    box-shadow: 0 18px 44px rgba(88, 98, 255, 0.15);
}

.debate-type-card:has(input:checked) .option-check {
    color: var(--primary);
}

.create-form-panel {
    margin-top: 18px;
    padding: 22px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.form-status {
    color: var(--green);
    background: var(--green-soft);
}

.debate-mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 0;
    padding: 10px;
    background: #f8faff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.debate-mode-switch legend {
    grid-column: 1 / -1;
    padding: 0 0 2px;
    color: #34405f;
    font-weight: 900;
}

.mode-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    min-width: 0;
    padding: 12px;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.mode-option input {
    width: 17px;
    height: 17px;
    margin-top: 3px;
    accent-color: var(--primary);
}

.mode-option span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.mode-option strong {
    color: #111936;
    font-size: 14px;
}

.mode-option small {
    color: #66718f;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.mode-option:has(input:checked) {
    border-color: #aeb6ff;
    box-shadow: 0 12px 28px rgba(88, 98, 255, 0.12);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.create-mode-panel[hidden] {
    display: none !important;
}

.live-panel {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    margin-top: 16px;
}

.field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.field-wide {
    grid-column: 1 / -1;
}

.field span,
.toggle-row span {
    color: #34405f;
    font-weight: 800;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    color: var(--text);
    background: #f9fbff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    outline: 0;
}

.field input,
.field select {
    height: 42px;
    padding: 0 12px;
}

.field textarea {
    resize: vertical;
    min-height: 108px;
    padding: 12px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: #aeb6ff;
    box-shadow: 0 0 0 4px rgba(88, 98, 255, 0.1);
}

.current-user-card,
.selected-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    background: #f9fbff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.current-user-card .profile-avatar,
.user-result-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    color: #1723a9;
    font-weight: 900;
    background: var(--primary-soft);
    border-radius: 50%;
}

.current-user-card span:last-child,
.selected-user-card span:last-child {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.current-user-card small,
.selected-user-card small,
.user-result small {
    overflow: hidden;
    color: #66718f;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.current-user-card strong,
.selected-user-card strong,
.user-result strong {
    overflow: hidden;
    color: #111936;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.current-user-card em {
    overflow: hidden;
    color: #66718f;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-autocomplete {
    position: relative;
    min-width: 0;
}

.user-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 75;
    display: grid;
    gap: 4px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.user-results[hidden] {
    display: none;
}

.user-result {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 9px;
    text-align: left;
    cursor: pointer;
    background: transparent;
    border-radius: var(--radius);
}

.user-result:hover,
.user-result:focus {
    background: #f3f5ff;
    outline: 0;
}

.user-results-empty {
    padding: 11px 10px;
    color: #66718f;
    font-weight: 800;
}

.selected-user-card {
    margin-top: 10px;
}

.context-field {
    margin-top: 16px;
}

.mediation-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) 220px;
    gap: 14px;
    align-items: end;
    margin-top: 16px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    background: #f9fbff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.toggle-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
}

.compact-field {
    align-self: stretch;
}

.create-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-top: 22px;
}

.ghost-link {
    color: #53607d;
    font-weight: 800;
}

.create-submit {
    width: auto;
    min-width: 172px;
    padding: 0 18px;
}

/* Debate history */
.history-content {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 18px 24px 24px;
}

.history-hero {
    grid-template-columns: minmax(0, 1fr) minmax(360px, auto);
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    background: #ffffff;
    box-shadow: none;
}

.history-hero .hero-kicker {
    font-size: 12px;
}

.history-hero h1 {
    margin-top: 6px;
    font-size: 24px;
    line-height: 1.15;
}

.history-hero p {
    max-width: 760px;
    margin-top: 5px;
    font-size: 13px;
}

.history-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.history-stats span {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    min-height: 0;
    padding: 7px 10px;
    color: #53607d;
    font-size: 12px;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.history-stats strong {
    color: #111936;
    font-size: 17px;
    line-height: 1;
}

.history-toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) repeat(4, minmax(118px, 150px));
    gap: 8px;
    align-items: end;
    padding: 10px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: none;
}

.history-search {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 10px;
    color: #53607d;
    background: #f9fbff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.history-search input {
    min-width: 0;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
}

.history-filter {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.history-filter span {
    color: #53607d;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.history-filter select {
    width: 100%;
    height: 36px;
    padding: 0 9px;
    color: var(--text);
    font-size: 13px;
    background: #f9fbff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    outline: 0;
}

.history-filter select:focus,
.history-search:focus-within {
    border-color: #aeb6ff;
    box-shadow: 0 0 0 4px rgba(88, 98, 255, 0.1);
}

.history-list {
    display: grid;
    gap: 8px;
}

.history-empty {
    display: grid;
    gap: 10px;
    justify-items: start;
    padding: 16px;
    color: #53607d;
}

/* Le display:grid ci-dessus écrase le [hidden] de l'UA : on le rétablit explicitement. */
.history-empty[hidden] {
    display: none;
}

.history-empty strong {
    color: #16213d;
    font-size: 18px;
}

.history-new-button {
    width: auto;
    min-width: 170px;
    padding: 0 18px;
}

.history-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px 14px;
    overflow: visible;
    box-shadow: none;
}

.history-card-main {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 0;
}

.history-card-main header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.history-card-main header > div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.history-role-pill,
.history-kind-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    color: #34405f;
    font-size: 11px;
    font-weight: 900;
    background: #f3f5ff;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.history-kind-pill {
    color: #2e5b38;
    background: var(--green-soft);
    border-color: #ceebd9;
}

.favorite-toggle-form {
    flex: 0 0 auto;
}

.favorite-button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: #7b849d;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.favorite-button.is-active {
    color: #c98212;
    background: var(--amber-soft);
    border-color: #f0d59a;
}

.favorite-button:hover,
.favorite-button:focus {
    color: #c98212;
    outline: 0;
    box-shadow: 0 0 0 4px rgba(201, 130, 18, 0.12);
}

.history-card h2 {
    margin: 0;
    color: #111936;
    font-size: 16px;
    line-height: 1.25;
}

.history-card p {
    margin: 0;
    color: #53607d;
    font-size: 13px;
    line-height: 1.35;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.history-card small {
    color: #66718f;
    font-size: 12px;
    font-weight: 700;
}

.history-card footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 0;
    color: #53607d;
    font-size: 12px;
    font-weight: 800;
    background: transparent;
    border-left: 0;
    white-space: normal;
}

.history-card footer span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 0 9px;
    white-space: nowrap;
    background: #f8faff;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.history-card footer .icon {
    width: 14px;
    height: 14px;
}

.history-card footer .open-button {
    width: auto;
    min-width: 84px;
    height: 30px;
    margin-top: 0;
    margin-left: auto;
    font-size: 11px;
}

.history-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.history-card-actions .open-button {
    margin-left: 0;
}

.history-delete-form {
    display: flex;
    margin: 0;
}

.card-delete-button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--danger);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.card-delete-button:hover,
.card-delete-button:focus {
    background: var(--danger-soft);
    border-color: var(--danger);
}

.card-delete-button .icon {
    width: 15px;
    height: 15px;
}

@media (max-width: 1220px) {
    .debate-shell {
        --composer-dock-left: calc(240px + 34px);
        --composer-dock-right: 34px;
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .debate-summary {
        grid-column: 2;
        grid-row: 3;
        padding: 0 24px 24px;
    }

    .summary-panel {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-panel h2,
    .debate-mediator-panel {
        grid-column: 1 / -1;
    }

    .create-hero {
        grid-template-columns: 1fr;
    }

    .mediation-settings {
        grid-template-columns: 1fr;
    }

    .history-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .history-stats {
        justify-content: flex-start;
    }

    .history-search {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1020px) {
    .ai-analysis-content {
        grid-template-columns: 1fr;
    }

    .ai-score,
    .ai-sources {
        border-left: 0;
        border-top: 1px solid #d9def0;
        padding: 14px 0 0;
    }

    .debate-type-grid {
        grid-template-columns: 1fr;
    }

    .debate-mode-switch,
    .live-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .debate-content,
    .debate-summary,
    .create-content {
        padding: 18px 16px;
    }

    .debate-shell {
        --composer-dock-left: 16px;
        --composer-dock-right: 16px;
    }

    .debate-content {
        padding-bottom: var(--debate-content-bottom, 18px);
    }

    .debate-header {
        display: grid;
    }

    .debate-header-actions {
        justify-content: flex-start;
    }

    .summary-panel {
        grid-template-columns: 1fr;
    }

    .create-shell {
        display: block;
    }

    .history-card {
        grid-template-columns: 1fr;
    }

    .history-card footer {
        min-width: 0;
        border-left: 0;
        border-top: 0;
    }

    .history-stats,
    .history-toolbar {
        grid-template-columns: 1fr;
    }

    .history-content {
        gap: 10px;
        padding: 14px 12px 18px;
    }

    .history-hero,
    .history-toolbar,
    .history-card {
        padding: 12px;
    }

    .history-search {
        grid-column: auto;
    }
}

@media (max-width: 660px) {
    .debate-content--with-composer {
        --debate-content-bottom: 202px;
    }

    .thread-row {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 10px;
    }

    .self-thread-row {
        grid-template-columns: minmax(0, 1fr) 34px;
    }

    .participant-avatar,
    .ai-avatar {
        width: 34px;
        height: 34px;
        font-size: 12px;
    }

    .chat-message {
        grid-template-columns: 1fr;
    }

    .truth-badge {
        width: fit-content;
    }

    .message-composer {
        grid-template-columns: 38px minmax(0, 1fr) 42px;
    }

    .ai-request-button {
        grid-column: 1 / -1;
        order: 4;
    }

    .composer-note {
        margin-left: 0;
    }

    .composer-dock .composer-note {
        margin-left: 0;
    }

    .debate-shell + .toast {
        bottom: 176px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .create-actions {
        display: grid;
        justify-items: stretch;
    }

    .create-submit {
        width: 100%;
    }
}

/* Authentication */
body.auth-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #fbfcff 0%, #f4f7ff 56%, #ffffff 100%);
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(360px, 480px) minmax(0, 520px);
    gap: 28px;
    align-items: stretch;
    justify-content: center;
    min-height: 100vh;
    padding: 42px 24px;
}

.auth-panel,
.auth-preview {
    align-self: center;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.auth-panel {
    display: grid;
    gap: 22px;
    padding: 30px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    width: fit-content;
}

.auth-brand strong {
    display: block;
    color: #081129;
    font-size: 22px;
    line-height: 1.1;
}

.auth-brand small {
    display: block;
    margin-top: 4px;
    color: #62708d;
    font-size: 13px;
}

.auth-heading h1 {
    margin: 12px 0 0;
    color: #111936;
    font-size: 30px;
    line-height: 1.12;
}

.auth-alert {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    color: #9a3512;
    background: #fff2df;
    border: 1px solid #ffd7a4;
    border-radius: var(--radius);
}

.auth-alert p {
    margin: 0;
    font-weight: 800;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form .field input {
    height: 46px;
    background: #f9fbff;
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    color: #ffffff;
    font-weight: 900;
    background: linear-gradient(135deg, #4e6bff 0%, #7358ff 100%);
    border-radius: var(--radius);
    box-shadow: 0 14px 28px rgba(88, 98, 255, 0.25);
    cursor: pointer;
}

.auth-switch {
    margin: 0;
    color: #53607d;
    font-weight: 700;
    text-align: center;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 900;
}

.auth-preview {
    display: grid;
    grid-template-rows: minmax(220px, 300px) auto;
    overflow: hidden;
    min-height: 560px;
}

.auth-preview img {
    width: 100%;
    height: 100%;
    padding: 30px;
    object-fit: contain;
    background: linear-gradient(135deg, #eef1ff 0%, #ffffff 100%);
}

.auth-preview div {
    padding: 26px;
    border-top: 1px solid var(--line);
}

.auth-preview h2 {
    margin: 14px 0 8px;
    color: #111936;
    font-size: 24px;
    line-height: 1.18;
}

.auth-preview p {
    margin: 0;
    color: #53607d;
    font-size: 15px;
}

@media (max-width: 920px) {
    .auth-shell {
        grid-template-columns: minmax(0, 520px);
        padding: 24px 16px;
    }

    .auth-preview {
        display: none;
    }
}

@media (max-width: 520px) {
    .auth-shell {
        min-height: auto;
        padding: 16px;
    }

    .auth-panel {
        padding: 22px;
    }

    .auth-heading h1 {
        font-size: 26px;
    }
}

/* ===== Illustrations de débat (tags d'image) ===== */

/* Sélecteur de tag à la création */
.illustration-picker {
    margin: 0;
    padding: 14px 16px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fbfcff;
}

.illustration-picker > legend {
    padding: 0 6px;
    color: #16213d;
    font-weight: 800;
}

.illustration-help {
    margin: 0 0 12px;
    color: #53607d;
    font-size: 13px;
}

.illustration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
    gap: 10px;
}

.illustration-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.illustration-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.illustration-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    background: #f3f5ff;
}

.illustration-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.illustration-label {
    color: #34405f;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.illustration-option:hover {
    border-color: var(--primary);
}

.illustration-option:has(input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-soft);
}

.illustration-option:has(input:focus-visible) {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Vignette sur les cartes de liste (historique, mes débats, favoris) */
.history-card {
    grid-template-columns: 88px minmax(0, 1fr);
    column-gap: 14px;
}

.history-card-illustration {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #f3f5ff;
}

.history-card-main,
.history-card footer {
    grid-column: 2;
}

/* Illustration en tête de la page débat */
.debate-header-illustration {
    flex: none;
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #f3f5ff;
}

.debate-header > div:not(.debate-header-actions) {
    margin-right: auto;
}

/* Illustration sur la page de partage public */
.share-debate-illustration {
    display: block;
    width: 104px;
    height: 104px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #f3f5ff;
    margin-bottom: 12px;
}

@media (max-width: 540px) {
    .history-card {
        grid-template-columns: 64px minmax(0, 1fr);
        column-gap: 10px;
    }

    .history-card-illustration {
        width: 64px;
        height: 64px;
    }
}

/* ===== Pages compte : profil, tableau de bord, notifications, aide ===== */
.account-content {
    gap: 14px;
}

.page-hero {
    padding: 22px 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f6f8ff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.page-hero .hero-kicker {
    font-size: 13px;
}

.page-hero h1 {
    margin: 10px 0 6px;
    font-size: 26px;
    color: #16213d;
}

.page-hero p {
    max-width: 720px;
    margin: 0;
    color: #66718f;
}

.top-actions .icon-button {
    color: #53607d;
}

.account-card {
    padding: 22px 24px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.account-card-title {
    margin: 0 0 16px;
    font-size: 17px;
    color: #16213d;
}

.account-note {
    margin: 16px 0 0;
    color: #8a94ab;
    font-size: 13px;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-identity-avatar {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 900;
    color: #4e35cc;
    background: linear-gradient(180deg, #e7dcff 0%, #cdb9ff 100%);
}

.profile-identity-main h2 {
    margin: 0;
    font-size: 20px;
    color: #16213d;
}

.profile-identity-main p {
    margin: 4px 0 0;
    color: #66718f;
}

.profile-identity-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.account-info-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
}

.account-info-list dt {
    color: #8a94ab;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.account-info-list dd {
    margin: 4px 0 0;
    color: #16213d;
    font-weight: 700;
    word-break: break-word;
}

.account-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.account-stat {
    display: grid;
    gap: 6px;
    padding: 18px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.account-stat-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 12px;
}

.account-stat-icon .icon {
    width: 20px;
    height: 20px;
}

.account-stat strong {
    font-size: 26px;
    line-height: 1;
    color: #16213d;
}

.account-stat-label {
    color: #66718f;
    font-size: 13px;
    font-weight: 700;
}

.account-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.account-help-card {
    display: grid;
    gap: 8px;
    align-content: start;
}

.account-help-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 12px;
}

.account-help-icon .icon {
    width: 20px;
    height: 20px;
}

.account-help-card h2 {
    margin: 4px 0 0;
    font-size: 17px;
    color: #16213d;
}

.account-help-card p {
    margin: 0;
    color: #66718f;
}

.account-help-card .ghost-button {
    justify-self: start;
    margin-top: 6px;
}

.faq-list {
    display: grid;
    gap: 8px;
}

.faq-item {
    padding: 14px 16px;
    background: #f8faff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.faq-item summary {
    color: #16213d;
    font-weight: 800;
    cursor: pointer;
}

.faq-item p {
    margin: 10px 0 0;
    color: #53607d;
}

.account-empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 40px 24px;
    text-align: center;
}

.account-empty-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 50%;
}

.account-empty-icon .icon {
    width: 24px;
    height: 24px;
}

.account-empty strong {
    font-size: 17px;
    color: #16213d;
}

.account-empty span {
    color: #66718f;
}

.notification-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.notification-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.notification-item.is-unread {
    background: #f3f5ff;
    border-color: #d9def9;
}

.notification-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 12px;
}

.notification-item strong {
    color: #16213d;
}

.notification-item p {
    margin: 2px 0 0;
    color: #53607d;
}

.notification-item small {
    color: #8a94ab;
}

.profile-popover-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 0 12px;
    color: #34405f;
    background: #f8faff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-weight: 800;
    text-align: left;
}

.profile-popover-link:hover {
    background: #eef2ff;
}

.profile-popover-link .icon {
    width: 18px;
    height: 18px;
}

@media (max-width: 860px) {
    .account-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .account-card-grid,
    .account-info-list {
        grid-template-columns: 1fr;
    }
}
