/* =========================================================
   IA DÉBAT — GLOBAL DESIGN SYSTEM
   ========================================================= */

/* =========================================================
   ROOT / DARK THEME
   ========================================================= */

:root {
    /* -----------------------------------------------------
       BRAND
       ----------------------------------------------------- */

    --color-0: #FF6B35;
    --color-0-hover: #FF8A5C;
    --color-0-active: #E85A2A;

    --color-1: #4A3BFF;
    --color-1-hover: #6B5CFF;

    --color-2: #00A86B;
    --color-2-hover: #24C88A;

    --color-3: #E53E3E;
    --color-3-hover: #FF6464;

    --color-success: #2BB673;

    /* -----------------------------------------------------
       RAW NEUTRAL PALETTE
       ----------------------------------------------------- */

    --color-black: #1B232A;

    --color-gray-950: #101519;
    --color-gray-900: #151B20;
    --color-gray-850: #1A2127;
    --color-gray-800: #1E272E;
    --color-gray-750: #222B32;
    --color-gray-700: #28323A;
    --color-gray-650: #303A42;
    --color-gray-600: #394149;
    --color-gray-500: #4B555D;
    --color-gray-400: #737A80;
    --color-gray-300: #8E9499;
    --color-gray-200: #A5AAAE;
    --color-gray-100: #C7CBCE;
    --color-gray-50: #E5E8EA;

    /* -----------------------------------------------------
       SEMANTIC SURFACES
       ----------------------------------------------------- */

    --background-color: var(--color-gray-950);

    --surface-0: var(--color-gray-900);
    --surface-1: var(--color-black);
    --surface-2: var(--color-gray-750);
    --surface-3: var(--color-gray-700);
    --surface-raised: #202A31;

    --div-color: var(--surface-1);

    /* -----------------------------------------------------
       SEMANTIC TEXT
       ----------------------------------------------------- */

    --text: #F5F6F7;
    --text-secondary: var(--color-gray-200);
    --text-muted: var(--color-gray-400);

    /* -----------------------------------------------------
       SEMANTIC BORDERS
       ----------------------------------------------------- */

    --border-color: rgba(255, 255, 255, 0.07);
    --border-color-strong: rgba(255, 255, 255, 0.11);
    --border-strong: var(--color-gray-600);

    /* -----------------------------------------------------
       SEMANTIC STATUS
       ----------------------------------------------------- */

    --success-bg: rgba(43, 182, 115, 0.10);
    --success-border: rgba(43, 182, 115, 0.25);
    --success-text: #BCEFD7;
    --success-text-strong: #D9F7E8;

    --error-bg: rgba(229, 62, 62, 0.10);
    --error-border: rgba(229, 62, 62, 0.25);
    --error-text: #FFB1B1;
    --error-text-strong: #FF7777;

    --warning-bg: rgba(255, 107, 53, 0.10);
    --warning-border: rgba(255, 107, 53, 0.25);
    --warning-text: #FFD0BE;

    /* -----------------------------------------------------
       SELECTION
       ----------------------------------------------------- */

    --selection-background: rgba(255, 107, 53, 0.25);

    /* -----------------------------------------------------
       SHADOWS
       ----------------------------------------------------- */

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.22);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.28);
    --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.35);

    /* -----------------------------------------------------
       RADII
       ----------------------------------------------------- */

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* -----------------------------------------------------
       SPACING
       ----------------------------------------------------- */

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;

    /* -----------------------------------------------------
       TRANSITIONS
       ----------------------------------------------------- */

    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}


/* =========================================================
   LIGHT THEME
   ========================================================= */

.theme-light {
    /* -----------------------------------------------------
       SEMANTIC SURFACES
       ----------------------------------------------------- */

    --background-color: #F5F6F7;

    --surface-0: #FFFFFF;
    --surface-1: #FFFFFF;
    --surface-2: #F0F2F3;
    --surface-3: #E6E9EB;
    --surface-raised: #FFFFFF;

    --div-color: var(--surface-1);

    /* -----------------------------------------------------
       SEMANTIC TEXT
       ----------------------------------------------------- */

    --text: #1B232A;
    --text-secondary: #596168;
    --text-muted: #737A80;

    /* -----------------------------------------------------
       SEMANTIC BORDERS
       ----------------------------------------------------- */

    --border-color: rgba(27, 35, 42, 0.10);
    --border-color-strong: rgba(27, 35, 42, 0.16);
    --border-strong: #737A80;

    /* -----------------------------------------------------
       STATUS
       ----------------------------------------------------- */

    --success-bg: rgba(43, 182, 115, 0.10);
    --success-border: rgba(43, 182, 115, 0.25);
    --success-text: #177A4E;
    --success-text-strong: #12633F;

    --error-bg: rgba(229, 62, 62, 0.08);
    --error-border: rgba(229, 62, 62, 0.22);
    --error-text: #B52E2E;
    --error-text-strong: #9E2626;

    --warning-bg: rgba(255, 107, 53, 0.08);
    --warning-border: rgba(255, 107, 53, 0.22);
    --warning-text: #A94320;

    /* -----------------------------------------------------
       SELECTION
       ----------------------------------------------------- */

    --selection-background: rgba(255, 107, 53, 0.20);

    /* -----------------------------------------------------
       SHADOWS
       ----------------------------------------------------- */

    --shadow-sm: 0 2px 8px rgba(27, 35, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(27, 35, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(27, 35, 42, 0.10);
    --shadow-xl: 0 30px 80px rgba(27, 35, 42, 0.14);
}


/* =========================================================
   THEME SWITCH
   ========================================================= */

.theme-switch {
    display: inline-flex !important;
    align-items: center;

    gap: 3px;
    padding: 3px;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-pill) !important;

    background: var(--surface-2) !important;

    box-shadow: var(--shadow-sm);
}

.theme-switch .theme-switch-button {
    width: 34px;
    height: 30px;
    min-height: 30px !important;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    padding: 0 !important;

    border: 0 !important;
    border-radius: var(--radius-pill) !important;

    background: transparent !important;
    color: var(--text-muted) !important;

    font-size: 15px !important;
    line-height: 1;
    font-weight: 400 !important;

    box-shadow: none !important;
    transform: none !important;

    transition:
        background-color var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.theme-switch .theme-switch-button:hover {
    background: var(--color-gray-100) !important;
    color: var(--text) !important;
    transform: none !important;
}

.theme-switch .theme-switch-button.active {
    background: var(--color-gray) !important;
    color: #FFFFFF !important;
    box-shadow: var(--shadow-sm);
}

.theme-switch .theme-switch-button.active:hover {
    background: var(--color-gray-600) !important;
    color: #FFFFFF !important;
}

.theme-switch .theme-switch-button:hover {
    background: var(--color-gray-200) !important;
}

.theme-switch .theme-switch-button.active {
    background: var(--color-gray-500) !important;
    color: #FFFFFF !important;
}

.theme-switch .theme-switch-button.active:hover {
    background: var(--color-gray-600) !important;
    color: #FFFFFF !important;
}


/* =========================================================
   NAVBAR BASE
   ========================================================= */

.navbar {
    background-color: var(--surface-1) !important;
    color: var(--text) !important;
}

.navbar-brand,
.navbar-brand h2,
.navbar .nav-link,
.navbar .btn {
    color: var(--text) !important;
}

/* =========================================================
   NAVBAR TOGGLER
   ========================================================= */

.navbar-toggler {
    border: 1px solid var(--border-color-strong) !important;
    border-radius: var(--radius-md);

    background-color: var(--surface-2);

    padding: 8px 10px;

    box-shadow: none !important;

    transition:
        background-color var(--transition-normal),
        border-color var(--transition-normal);
}

.navbar-toggler:hover {
    background-color: var(--surface-3);
    border-color: var(--border-strong) !important;
}

.navbar-toggler:focus {
    background-color: var(--surface-2);
    border-color: var(--color-0) !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.10) !important;
}

/* Hamburger icon */
.navbar-toggler-icon {
    background-image: none !important;

    width: 22px;
    height: 18px;

    display: block;

    position: relative;

    border-top: 2px solid var(--text);
    border-bottom: 2px solid var(--text);
}

/* Middle hamburger line */
.navbar-toggler-icon::before {
    content: "";

    position: absolute;

    left: 0;
    right: 0;
    top: 50%;

    height: 2px;

    background-color: var(--text);

    transform: translateY(-50%);
}


/* =========================================================
   GLOBAL RESET / BASE
   ========================================================= */

html {
    background: var(--background-color);
}

body {
    margin: 0;

    font-family: "Roboto", sans-serif;
    font-size: 14px;
    line-height: 1.5;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(255, 107, 53, 0.025),
            transparent 35%
        ),
        var(--background-color);

    color: var(--text);

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

::selection {
    background: var(--selection-background);
    color: var(--text);
}


/* =========================================================
   TEXT
   ========================================================= */

.body-text {
    color: var(--text);
    font-family: "Roboto", sans-serif;
}

.text-muted {
    color: var(--text-muted) !important;
}


/* =========================================================
   GENERIC SURFACES
   ========================================================= */

.bg-primary {
    background-color: var(--div-color) !important;
}

.header {
    background-color: var(--surface-0);
    border-bottom: 1px solid var(--border-color);
}

.div-border-radius {
    border-radius: var(--radius-lg);
    background-color: var(--div-color);
    border: 1px solid var(--border-color);
}

.card {
    --bs-card-bg: transparent !important;
    --bs-card-border-color: transparent !important;

    color: var(--text);
}

.center {
    display: block;
    width: 50%;
    margin-left: auto;
    margin-right: auto;
}


/* =========================================================
   BUTTON SYSTEM
   ========================================================= */

.btn {
    min-height: 42px;
    padding: 0.55rem 1rem;

    border-radius: var(--radius-md) !important;

    font-family: "Roboto", sans-serif !important;
    font-weight: 500 !important;

    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast);
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled,
button:disabled {
    transform: none !important;
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: 0.55;
}


/* ---------------------------------------------------------
   Primary
   --------------------------------------------------------- */

.btn-primary {
    border: 1px solid var(--color-0) !important;

    background-color: var(--color-0) !important;
    color: var(--color-black) !important;
}

.btn-primary:hover:not(:disabled) {
    border-color: var(--color-0-hover) !important;
    background-color: var(--color-0-hover) !important;
    color: var(--color-black) !important;

    box-shadow: 0 6px 18px rgba(255, 107, 53, 0.18);
}

.btn-primary:active:not(:disabled),
.btn-primary.active {
    border-color: var(--color-0-active) !important;
    background-color: var(--color-0-active) !important;
    color: var(--color-black) !important;
}

.btn-primary:focus-visible {
    box-shadow:
        0 0 0 3px rgba(255, 107, 53, 0.15) !important;
}


/* ---------------------------------------------------------
   Secondary
   --------------------------------------------------------- */

.btn-secondary {
    border: 1px solid var(--border-strong) !important;

    background-color: var(--surface-raised) !important;
    color: var(--text) !important;
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--color-0) !important;
    background-color: var(--surface-raised) !important;
    color: var(--text) !important;

    box-shadow: 0 6px 18px rgba(255, 107, 53, 0.12);
}

.btn-secondary:active:not(:disabled),
.btn-secondary.active {
    background-color: var(--surface-2) !important;
    color: var(--text) !important;
}


/* ---------------------------------------------------------
   Outline primary
   --------------------------------------------------------- */

.btn-outline-primary {
    border: 1px solid var(--color-0) !important;

    background-color: transparent !important;
    color: var(--color-0) !important;
}

.btn-outline-primary:hover:not(:disabled) {
    border-color: var(--color-0) !important;
    background-color: var(--color-0) !important;
    color: var(--color-black) !important;

    box-shadow: 0 6px 18px rgba(255, 107, 53, 0.16);
}

.btn-outline-primary:active:not(:disabled),
.btn-outline-primary.active {
    background-color: var(--color-0) !important;
    color: var(--color-black) !important;
}


/* ---------------------------------------------------------
   Outline secondary
   --------------------------------------------------------- */

.btn-outline-secondary {
    border: 1px solid var(--border-strong) !important;

    background-color: transparent !important;
    color: var(--text) !important;
}

.btn-outline-secondary:hover:not(:disabled) {
    border-color: var(--surface-raised) !important;

    background-color: var(--surface-raised) !important;
    color: var(--color-0) !important;

    box-shadow: 0 6px 18px rgba(255, 107, 53, 0.10);
}


/* ---------------------------------------------------------
   Light
   --------------------------------------------------------- */

.btn-light {
    border: 1px solid var(--border-color) !important;

    background-color: var(--surface-2) !important;
    color: var(--text) !important;
}

.btn-light:hover:not(:disabled) {
    border-color: var(--border-color-strong) !important;

    background-color: var(--surface-3) !important;
    color: var(--text) !important;
}


/* ---------------------------------------------------------
   Transparent
   --------------------------------------------------------- */

.transparent-button {
    width: auto !important;
    padding: 0 !important;

    border: none !important;

    background: transparent !important;
    color: inherit !important;

    cursor: pointer !important;
}

.transparent-button:hover {
    background: transparent !important;
    color: var(--color-0) !important;
}

.transparent-button:active {
    background: transparent !important;
}


/* ---------------------------------------------------------
   Button arrow
   --------------------------------------------------------- */

.button-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;

    margin-left: 12px;

    border-radius: var(--radius-sm);

    background: var(--color-black);
    color: var(--color-0);

    font-size: 16px;
    line-height: 1;

    transition:
        background-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.btn:hover .button-arrow {
    transform: translateX(3px);
}

.button-arrow:hover {
    background: var(--color-gray) !important;
    color: var(--color-0) !important;
}


/* =========================================================
   ICON / SOURCE / SEND BUTTONS
   ========================================================= */

.icon-button {
    width: 34px;
    height: 34px;

    min-height: 34px !important;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    padding: 0 !important;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;

    background: var(--surface-2) !important;
    color: var(--text-secondary) !important;

    font-size: 16px !important;
}

.icon-button:hover {
    border-color: rgba(255, 107, 53, 0.35) !important;

    background: rgba(255, 107, 53, 0.08) !important;
    color: var(--color-0) !important;

    box-shadow: var(--shadow-sm);
}

.send-button {
    min-width: 120px;
    height: 44px;

    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    padding: 0 16px !important;

    border-radius: var(--radius-md) !important;

    font-size: 14px !important;
}

.source-button {
    min-height: 40px;

    display: inline-flex !important;
    align-items: center;

    padding: 0 14px !important;

    border-radius: var(--radius-md) !important;

    font-size: 13px !important;
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.navbar-custom {
    background-color: rgba(16, 21, 25, 0.88) !important;

    border-bottom: 1px solid var(--border-color) !important;

    color: var(--text) !important;

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.theme-light .navbar-custom {
    background-color: rgba(255, 255, 255, 0.88) !important;
}

.navbar-custom .nav-link,
.nav-link-custom {
    position: relative;

    color: var(--text-secondary) !important;

    transition: color var(--transition-normal);
}

.navbar-custom .nav-link:hover,
.nav-link-custom:hover {
    color: var(--text) !important;
}

.navbar-custom .nav-link.active,
.nav-link-custom.active {
    color: var(--color-0) !important;
}

.app-navigation {
    gap: 4px;
}

.app-navigation .nav-link {
    border-radius: var(--radius-md);

    color: var(--text-secondary) !important;

    font-weight: 400;

    transition:
        color var(--transition-normal),
        background-color var(--transition-normal),
        transform var(--transition-normal);
}

.app-navigation .nav-link:hover {
    background: var(--surface-2);
    color: var(--text) !important;

    transform: translateY(-1px);
}

.app-navigation .nav-link.active {
    background: rgba(255, 107, 53, 0.08);
    color: var(--color-0) !important;
}


/* =========================================================
   APP HEADER
   ========================================================= */

.app-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-title {
    margin: 0;

    color: var(--text);

    font-size: 24px;
    line-height: 1.2;
    font-weight: 500;

    letter-spacing: -0.5px;
}


/* =========================================================
   OFFCANVAS
   ========================================================= */

.offcanvas {
    background-color: var(--surface-0);
    color: var(--text);

    border-left: 1px solid var(--border-color-strong);

    box-shadow: var(--shadow-xl);
}

.offcanvas-header {
    position: relative;

    display: flex;
    align-items: center;

    min-height: 68px;

    padding: 16px 18px 16px 20px;

    background: var(--surface-1);
    color: var(--text);

    border-bottom: 1px solid var(--border-color-strong);
}

/* Orange accent */
.offcanvas-header::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;
    right: 0;

    height: 3px;

    background: linear-gradient(
        90deg,
        var(--color-0),
        var(--color-0-hover)
    );
}

.offcanvas-header .offcanvas-title {
    margin: 0;

    color: var(--text) !important;

    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.offcanvas-header .btn-close {
    width: 32px;
    height: 32px;

    margin: 0 0 0 auto;
    padding: 0;

    border: 0;
    border-radius: var(--radius-md);

    background-color: transparent;

    opacity: 0.55;
    filter: invert(1);

    box-shadow: none;

    transition:
        opacity var(--transition-normal),
        background-color var(--transition-normal),
        box-shadow var(--transition-normal),
        transform var(--transition-normal);
}

.offcanvas-header .btn-close:hover {
    opacity: 1;
    background-color: var(--surface-2);
}

.offcanvas-header .btn-close:focus {
    opacity: 1;

    background-color: var(--surface-2);

    box-shadow:
        0 0 0 3px rgba(255, 107, 53, 0.10);

    outline: none;
}

.theme-light .offcanvas-header .btn-close {
    filter: none;
}


/* =========================================================
   OFFCANVAS BODY
   ========================================================= */

.offcanvas-body {
    background-color: var(--background-color);
    color: var(--text);

    padding: 20px;
}


/* =========================================================
   DISCUSSION OFFCANVAS
   ========================================================= */

.discussion-offcanvas {
    width: min(50%, 720px) !important;
}

.discussion-offcanvas .offcanvas-body {
    scrollbar-width: thin;
    scrollbar-color: var(--color-0) transparent;
}

.discussion-offcanvas .offcanvas-body::-webkit-scrollbar {
    width: 8px;
}

.discussion-offcanvas .offcanvas-body::-webkit-scrollbar-track {
    background: transparent;
}

.discussion-offcanvas .offcanvas-body::-webkit-scrollbar-thumb {
    background: var(--color-0);

    border-radius: var(--radius-pill);
    border: 2px solid transparent;

    background-clip: padding-box;
}

.discussion-offcanvas .offcanvas-body::-webkit-scrollbar-thumb:hover {
    background: var(--color-0-hover);
    background-clip: padding-box;
}


/* =========================================================
   ACCORDION
   ========================================================= */

.accordion {
    --bs-accordion-bg: transparent;
    --bs-accordion-border-color: transparent;
    --bs-accordion-color: var(--text);
}

.accordion-item {
    margin-bottom: 8px;

    overflow: hidden;

    background: var(--surface-1) !important;
    color: var(--text) !important;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
}

.accordion-button {
    background: var(--surface-1) !important;
    color: var(--text) !important;

    border: none !important;
    box-shadow: none !important;

    font-weight: 500;
}

.accordion-button:hover {
    background: var(--surface-2) !important;
}

.accordion-button:focus {
    box-shadow:
        0 0 0 3px rgba(255, 107, 53, 0.10) !important;
}

.accordion-button.collapsed {
    box-shadow: none !important;
}

.accordion-button:not(.collapsed) {
    background: var(--surface-2) !important;
    color: var(--text) !important;

    border-bottom: 1px solid rgba(255, 107, 53, 0.30) !important;

    box-shadow: none !important;
}

.accordion-button.collapsed::after,
.accordion-button:not(.collapsed)::after {
    width: auto;
    height: auto;

    margin-left: auto;

    background-image: none;

    color: var(--color-0);

    font-size: 18px;
    font-weight: 400;
}

.accordion-button.collapsed::after {
    content: "+";
}

.accordion-button:not(.collapsed)::after {
    content: "−";
}


/* =========================================================
   FORMS
   ========================================================= */

.form-label,
.login-label {
    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;

    letter-spacing: 0.2px;
}

.form-control,
.form-select {
    min-height: 44px;

    border: 1px solid var(--color-gray-600) !important;
    border-radius: var(--radius-md) !important;

    background-color: var(--surface-2) !important;
    color: var(--text) !important;

    box-shadow: none !important;

    transition:
        border-color var(--transition-normal),
        background-color var(--transition-normal),
        box-shadow var(--transition-normal);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--color-gray-500) !important;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface-2) !important;
    color: var(--text) !important;

    border-color: var(--color-0) !important;

    box-shadow:
        0 0 0 3px rgba(255, 107, 53, 0.10) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
}

.form-control:disabled,
.form-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.form-select option {
    background-color: var(--surface-1) !important;
    color: var(--text) !important;
}


/* ---------------------------------------------------------
   Checkbox
   --------------------------------------------------------- */

.form-check {
    color: var(--text-secondary);
}

.form-check-input {
    background-color: var(--surface-2);
    border: 1px solid var(--color-gray-500);
}

.form-check-input:focus {
    border-color: var(--color-0);

    box-shadow:
        0 0 0 3px rgba(255, 107, 53, 0.10);
}

.form-check-input:checked {
    background-color: var(--color-0);
    border-color: var(--color-0);
}


/* =========================================================
   MODAL
   ========================================================= */

.modal-content {
    overflow: hidden;

    background-color: var(--surface-1) !important;
    color: var(--text) !important;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-xl) !important;

    box-shadow: var(--shadow-xl);
}

.modal-header {
    background-color: var(--surface-1) !important;
    color: var(--text) !important;

    border-bottom: 1px solid var(--border-color) !important;
}

.modal-title {
    color: var(--text);
    font-weight: 700;
}

.modal-body {
    background-color: var(--surface-1);
    color: var(--text);
}

.modal-footer {
    background-color: var(--surface-1) !important;

    border-top: 1px solid var(--border-color) !important;
}


/* =========================================================
   TOASTS
   ========================================================= */

.success-toast {
    overflow: hidden;

    border: 1px solid var(--success-border);
    border-radius: var(--radius-md);

    background: var(--success-bg);
    color: var(--success-text);

    box-shadow: var(--shadow-md);
}

.success-toast .toast-header {
    background: rgba(43, 182, 115, 0.18);

    color: var(--success-text-strong);

    border-bottom: 1px solid var(--success-border);
}


/* =========================================================
   ERROR / WARNING
   ========================================================= */

.error-state,
.warning-state {
    border-radius: var(--radius-md);
}

.error-state {
    border: 1px solid var(--error-border);

    background: var(--error-bg);
    color: var(--error-text);
}

.warning-state {
    border: 1px solid var(--warning-border);

    background: var(--warning-bg);
    color: var(--warning-text);
}


/* =========================================================
   DISCLAIMER
   ========================================================= */

.disclaimer {
    padding: 18px 20px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 107, 53, 0.05),
            var(--surface-1)
        );

    border-color: rgba(255, 107, 53, 0.12);
}

.disclaimer-title {
    margin-bottom: 5px;

    color: var(--color-0);

    font-size: 12px;
    font-weight: 500;

    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.disclaimer-content {
    margin: 0;

    color: var(--text-secondary);

    font-size: 12px;
    line-height: 1.6;
}


/* =========================================================
   MESSAGE SYSTEM
   ========================================================= */

.discussion-container,
.debate-container {
    width: 100%;
}

.message-row {
    margin-bottom: 24px;
}

.message-wrapper {
    width: 100%;
}

.message-header {
    min-height: 34px;

    margin-bottom: 8px;

    align-items: center;
}

.speaker-label {
    display: inline-flex;
    align-items: baseline;

    min-width: 0;

    font-size: 13px;
    line-height: 1.2;
}

.speaker-name {
    font-weight: 500;
    margin-right: 0.35em;
}

.speaker-party {
    opacity: 0.8;

    font-weight: 400;
}

.message-bubble {
    width: 100%;
    box-sizing: border-box;

    padding: 16px 18px;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);

    line-height: 1.65;

    overflow-wrap: anywhere;
    word-break: break-word;

    box-shadow: var(--shadow-sm);
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-content,
.message-text {
    margin: 0;

    font-size: 14px;
}

.user-message-bubble {
    width: min(78%, 760px);

    padding: 16px 18px;

    background: var(--surface-1);
    color: var(--text);

    border-color: var(--border-color-strong);
    border-radius: var(--radius-lg);

    line-height: 1.65;
}

.user-message-row {
    padding-right: 8px;
}


/* =========================================================
   DEBATE / DISCUSSION MESSAGE LAYOUT
   ========================================================= */

.debate-message {
    display: grid;

    grid-template-columns: 76px minmax(0, 1fr);
    column-gap: 16px;

    width: 100%;
    margin-bottom: 28px;

    align-items: start;
}

.debate-message.right {
    grid-template-columns: minmax(0, 1fr) 76px;
}

.debate-message-content {
    min-width: 0;
    width: 100%;
}

.debate-message-header {
    display: flex;
    align-items: center;
    gap: 8px;

    min-height: 28px;
    margin-bottom: 8px;
}

.debate-message.right .debate-message-header {
    justify-content: flex-end;
}

.debate-message-author {
    margin: 0;

    font-size: 0.92rem;
    line-height: 1.3;

    font-weight: 500;
}

.debate-message.right .message-bubble {
    text-align: left;
}


/* =========================================================
   AVATARS
   ========================================================= */

.party-avatar {
    flex-shrink: 0;

    display: inline-block;

    overflow: hidden;

    border: 2px solid;
    border-radius: 50%;

    background: var(--surface-2);

    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.18);
}

.debate-avatar-wrapper {
    width: 76px;
    height: 76px;

    display: flex;
    align-items: flex-start;
    justify-content: center;

    flex-shrink: 0;
}

.debate-avatar {
    width: 72px !important;
    height: 72px !important;

    min-width: 72px;
    min-height: 72px;

    object-fit: cover;
    object-position: center;

    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;

    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.22);
}


/* =========================================================
   USER MESSAGE
   ========================================================= */

.user-message {
    display: flex;
    justify-content: flex-end;

    width: 100%;
    margin-bottom: 28px;
}


/* =========================================================
   TYPING INDICATOR
   ========================================================= */

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    min-height: 28px;
    padding: 9px 12px;

    border-radius: var(--radius-md);

    background: var(--surface-2);
    border: 1px solid var(--border-color);

    box-shadow: var(--shadow-sm);

    vertical-align: middle;
}

.typing-dot {
    display: block;

    width: 4px;
    height: 4px;

    flex: 0 0 4px;

    border-radius: 50%;

    background: var(--color-0);

    opacity: 0.35;

    animation: typing-dot 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.18s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.36s;
}

@keyframes typing-dot {
    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-0.18em);
    }
}


/* =========================================================
   MESSAGE ALIGNMENT
   ========================================================= */

.discussion-message-debate-right .discussion-message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.discussion-message-debate-left .discussion-message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.discussion-message-debate-left .message-content,
.discussion-message-assistant .message-content {
    text-align: left;
}

.discussion-message-debate-right .message-content,
.discussion-message-user .message-content {
    text-align: right;
}


/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .typing-dot {
        animation: none;
        opacity: 0.7;
    }
}


/* =========================================================
   HISTORY
   ========================================================= */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;

    width: 100%;
    height: 100%;

    padding: 12px;
}

.history-card {
    width: 100%;

    margin: 0 !important;

    background: transparent !important;
    border: none !important;
}

.history-button {
    display: block !important;

    width: 100% !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 12px 14px !important;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;

    background: var(--surface-1) !important;
    color: var(--text) !important;

    text-align: left !important;

    font-family: "Roboto", sans-serif !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.35;

    transform: none !important;

    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast) !important;
}

.history-button:hover {
    transform: translateY(-1px) !important;

    border-color: var(--color-0) !important;

    background: var(--surface-2) !important;
    color: var(--text) !important;

    box-shadow:
        0 4px 12px rgba(255, 107, 53, 0.10);
}

.history-button:active {
    transform: translateY(0) !important;
}

.history-button,
.history-button span {
    font-weight: 400 !important;
}

.history-button-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    width: 100%;
}

.history-button-text {
    display: flex;
    flex-direction: column;

    min-width: 0;
    flex: 1;
}

.history-party-indicator {
    width: 10px;
    height: 10px;

    min-width: 10px;

    flex-shrink: 0;

    margin-top: 4px;

    border-radius: 50%;
}

.history-party-badges {
    display: flex;
    padding-top: 4px;
}

.history-party-badge {
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
}

.history-title {
    display: block;

    margin: 0;

    overflow-wrap: anywhere;

    color: var(--text);

    font-size: 14px;
    font-weight: 500 !important;
    line-height: 1.35;
}

.history-date {
    display: block;

    margin-top: 4px;

    color: var(--text-muted);

    font-size: 12px;
    font-weight: 400 !important;
    line-height: 1.3;
}


/* =========================================================
   DISCUSSION / DEBATE FORMS
   ========================================================= */

.discussion-form-row {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.discussion-party-select {
    margin-bottom: 12px;
}

.discussion-party-image-wrapper {
    width: 100%;

    display: flex;
    justify-content: center;
}

#discussion-party-image {
    margin-left: auto !important;
    margin-right: auto !important;
}

.discussion-input,
.debate-input {
    width: 100% !important;

    min-height: 52px !important;

    border-radius: var(--radius-md) !important;
}

.discussion-input {
    min-height: 110px !important;

    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;

    margin-top: 12px;
}


/* =========================================================
   DISCUSSION / DEBATE MESSAGES
   ========================================================= */

.discussion-messages {
    display: flex;
    flex-direction: column;
    gap: 28px;

    width: 100%;
}

.discussion-message-content {
    position: relative;

    min-width: 0;
}

.discussion-message .message-bubble {
    width: 100%;
    box-sizing: border-box;
}


/* =========================================================
   SPEAKER HEADER
   ========================================================= */

.speaker-header {
    position: relative;

    display: flex;
    align-items: center;

    width: 100%;
    min-height: 40px;

    margin-bottom: 10px;
}


/* =========================================================
   SOURCE BUTTON
   ========================================================= */

.speaker-header .source-button {
    position: absolute;

    top: 3px;

    width: 34px;
    height: 34px;
    min-height: 34px !important;

    padding: 0 !important;
    margin: 0 !important;

    flex: none;

    z-index: 2;
}


/* =========================================================
   DISCUSSION
   Avatar | 75% message block
   ========================================================= */

.discussion-message-assistant {
    display: flex;
    align-items: flex-start;

    gap: 14px;

    width: 100%;
}

.discussion-message-assistant .party-avatar {
    flex: 0 0 auto;
}

.discussion-message-assistant .discussion-message-content {
    width: 75%;
}

.discussion-message-assistant .source-button {
    right: 0;
}


/* =========================================================
   USER DISCUSSION MESSAGE
   ========================================================= */

.discussion-message-user {
    align-self: flex-end;

    width: 75%;
}

.discussion-message-user .message-content {
    text-align: right;
}

.discussion-message-user .message-bubble {
    width: 100%;
}


/* =========================================================
   DEBATE — LEFT
   Avatar | 75% message block
   ========================================================= */

.discussion-message-debate-left {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;

    gap: 14px;

    width: 100%;
}

.discussion-message-debate-left .party-avatar {
    flex: 0 0 auto;
}

.discussion-message-debate-left .discussion-message-content {
    width: 75%;
}

.discussion-message-debate-left .speaker-header {
    justify-content: flex-start;
}

.discussion-message-debate-left .speaker-label {
    padding-right: 44px;
}

.discussion-message-debate-left .source-button {
    right: 0;
}


/* =========================================================
   DEBATE — RIGHT
   75% message block | Avatar
   ========================================================= */

.discussion-message-debate-right {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;

    gap: 14px;

    width: 100%;
}

.discussion-message-debate-right .message-content {
    text-align: right;
}

.discussion-message-debate-right .party-avatar {
    flex: 0 0 auto;
}

.discussion-message-debate-right .discussion-message-content {
    width: 75%;
}

.discussion-message-debate-right .speaker-header {
    justify-content: flex-end;
}

.discussion-message-debate-right .speaker-label {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;

    width: 100%;
    min-width: 0;

    padding-left: 44px;

    text-align: right;

    box-sizing: border-box;
}

.discussion-message-debate-right .source-button {
    left: 0;
}


/* =========================================================
   AVATAR NORMALIZATION
   ========================================================= */

.discussion-message-debate-left .party-avatar,
.discussion-message-debate-right .party-avatar,
.discussion-message-assistant .party-avatar {
    flex: 0 0 auto;
}


/* =========================================================
   PARTY SELECTOR
   ========================================================= */

.debate-party-selector {
    padding: 16px;

    background: var(--surface-1);

    border-color: var(--border-color);
}

.debate-party-checklist {
    color: var(--text);
}

.debate-party-checklist .form-check {
    margin-bottom: 8px;
}


/* =========================================================
   CANVAS / SELECTED MESSAGE
   ========================================================= */

.canvas-message {
    padding: 4px;
}

.canvas-message .speaker-label {
    margin-bottom: 8px;
}

.sources-accordion {
    margin-top: 16px;
}


/* =========================================================
   SOURCES
   ========================================================= */

.source-title {
    display: flex;
    align-items: center;
    gap: 9px;

    color: var(--text);

    font-size: 13px;
}

.source-party-dot {
    width: 20px;
    height: 20px;

    flex: 0 0 20px;

    display: inline-block;

    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

.source-page {
    margin-bottom: 8px;

    color: var(--color-0);

    font-size: 12px;
    font-weight: 500;
}

.source-excerpt {
    color: var(--text-secondary);

    font-size: 13px;
    line-height: 1.65;
}


/* =========================================================
   PROGRAMMES
   ========================================================= */

.programs-container {
    width: 100%;
}


/* =========================================================
   PARTY SECTION
   ========================================================= */

.program-party-title {
    margin: 0 0 14px;

    color: var(--text);

    font-size: 18px;
    font-weight: 600;

    letter-spacing: -0.01em;
}


/* =========================================================
   PROGRAM CARD
   ========================================================= */

.program-card {
    position: relative;

    overflow: hidden;

    height: 100%;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;

    background: var(--surface-1) !important;

    box-shadow: var(--shadow-sm);

    transition:
        transform var(--transition-normal),
        border-color var(--transition-normal),
        box-shadow var(--transition-normal);
}

.program-card::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;

    width: 3px;
    height: 100%;

    background: var(--party-color);

    opacity: 0.65;

    transition:
        opacity var(--transition-normal),
        width var(--transition-normal);
}

.program-card:hover {
    transform: translateY(-2px);

    border-color: var(--border-color-strong) !important;

    box-shadow: var(--shadow-md);
}

.program-card:hover::before {
    width: 4px;
    opacity: 1;
}


/* =========================================================
   CARD BODY
   ========================================================= */

.program-card-body {
    position: relative;

    display: flex;
    flex-direction: column;

    min-height: 190px;

    padding: 18px !important;
}


/* =========================================================
   PARTY BADGE
   ========================================================= */

.program-card-header {
    display: flex;
    align-items: center;

    margin-bottom: 14px;
}

.program-party-badge {
    display: inline-flex;
    align-items: center;

    gap: 7px;

    width: fit-content;

    padding: 4px 9px;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);

    background: var(--surface-2);

    color: var(--text-secondary);

    font-size: 11px;
    font-weight: 600;

    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.program-party-dot {
    width: 7px;
    height: 7px;

    flex: 0 0 auto;

    border-radius: 50%;

    background: var(--party-color);

    box-shadow:
        0 0 0 2px color-mix(
            in srgb,
            var(--party-color) 15%,
            transparent
        );
}


/* =========================================================
   PROGRAM TITLE
   ========================================================= */

.program-title {
    margin: 0;

    color: var(--text);

    font-size: 17px;
    font-weight: 500;
    line-height: 1.4;

    letter-spacing: -0.01em;
}


/* =========================================================
   PROGRAM SPACER
   ========================================================= */

.program-spacer {
    flex: 1;

    min-height: 20px;
}


/* =========================================================
   PROGRAM BUTTON
   ========================================================= */

.program-button {
    width: 100%;
    min-height: 40px;

    display: flex !important;
    align-items: center;
    justify-content: space-between;

    padding: 0 12px !important;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;

    background: var(--surface-2) !important;
    color: var(--text-secondary) !important;

    font-size: 13px !important;
    font-weight: 500 !important;

    text-decoration: none !important;

    box-shadow: none !important;

    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.program-button:hover {
    background: var(--surface-3) !important;
    border-color: var(--border-color-strong) !important;

    color: var(--text) !important;

    transform: translateY(-1px);
}

.program-button:active {
    transform: translateY(0);
}


/* =========================================================
   LOGIN PAGE
   ========================================================= */

.login-page {
    position: relative;

    width: 100%;
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 40px 20px;

    overflow: hidden;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(255, 107, 53, 0.08),
            transparent 38%
        ),
        var(--background-color);
}

.login-page::before {
    content: "";

    position: absolute;

    width: 600px;
    height: 600px;

    top: -400px;
    left: 50%;

    transform: translateX(-50%);

    border: 1px solid rgba(255, 107, 53, 0.08);
    border-radius: 50%;

    box-shadow:
        0 0 0 80px rgba(255, 107, 53, 0.015),
        0 0 0 160px rgba(255, 107, 53, 0.012),
        0 0 0 240px rgba(255, 107, 53, 0.008);

    pointer-events: none;
}

.login-orb {
    position: absolute;

    border-radius: 50%;

    pointer-events: none;
}

.login-orb-1 {
    width: 350px;
    height: 350px;

    top: -250px;
    right: -180px;

    background: rgba(255, 107, 53, 0.07);

    filter: blur(50px);
}

.login-orb-2 {
    width: 250px;
    height: 250px;

    bottom: -180px;
    left: -120px;

    background: rgba(255, 107, 53, 0.05);

    filter: blur(50px);
}


/* =========================================================
   LOGIN CARD
   ========================================================= */

.login-card {
    position: relative;
    z-index: 2;

    width: 100%;
    max-width: 430px;

    padding: 44px 42px 32px;

    background: var(--surface-1);

    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);

    box-shadow: var(--shadow-xl);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}


/* =========================================================
   LOGIN BRAND
   ========================================================= */

.login-brand {
    display: flex;
    align-items: center;

    gap: 13px;

    margin-bottom: 52px;
}

.login-logo {
    width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border: 1px solid rgba(255, 107, 53, 0.18);
    border-radius: 12px;

    background: rgba(255, 107, 53, 0.10);
}

.login-logo img {
    width: 32px;
    height: 32px;

    object-fit: contain;
}

.login-brand-name {
    color: var(--text);

    font-size: 16px;
    font-weight: 700;

    letter-spacing: -0.2px;
}


/* =========================================================
   LOGIN HEADING
   ========================================================= */

.login-heading {
    margin-bottom: 22px;
}

.login-heading h1 {
    margin: 0 0 12px;

    color: var(--text);

    font-size: 38px;
    line-height: 1.05;
    font-weight: 700;

    letter-spacing: -1.5px;
}

.login-heading p {
    max-width: 340px;

    margin: 0;

    color: var(--text-secondary);

    font-size: 15px;
    line-height: 1.65;
}


/* =========================================================
   LOGIN TAGLINE
   ========================================================= */

.login-tagline {
    display: inline-flex;
    align-items: center;

    margin-bottom: 34px;

    color: var(--text-muted);

    font-size: 12px;
    font-weight: 500;

    letter-spacing: 0.1px;
}

.tagline-highlight {
    color: var(--color-0);
    font-weight: 700;
}


/* =========================================================
   LOGIN FORM
   ========================================================= */

.login-form {
    width: 100%;
}

.login-label {
    display: block;

    margin-bottom: 8px;
}

.login-input {
    width: 100% !important;
    height: 52px !important;

    box-sizing: border-box;

    padding: 0 16px !important;

    border: 1px solid var(--color-gray-600) !important;
    border-radius: var(--radius-md) !important;

    background: var(--surface-2) !important;
    color: var(--text) !important;

    font-size: 14px !important;

    box-shadow: none !important;

    transition:
        border-color var(--transition-normal),
        background-color var(--transition-normal),
        box-shadow var(--transition-normal);
}

.login-input:hover {
    border-color: var(--color-gray-500) !important;
}

.login-input::placeholder {
    color: var(--text-muted) !important;
}

.login-input:focus {
    background: var(--surface-2) !important;
    color: var(--text) !important;

    border-color: var(--color-0) !important;

    box-shadow:
        0 0 0 3px rgba(255, 107, 53, 0.10) !important;
}


/* =========================================================
   LOGIN BUTTON
   ========================================================= */

.login-button {
    width: 100%;
    height: 52px;

    margin-top: 12px;

    display: flex !important;
    align-items: center;
    justify-content: center;

    padding: 0 17px !important;

    border: 1px solid var(--color-0) !important;
    border-radius: var(--radius-md) !important;

    background: var(--color-0) !important;
    color: var(--color-black) !important;

    font-size: 14px !important;
    font-weight: 500 !important;

    box-shadow: none !important;

    transition:
        background-color var(--transition-normal),
        border-color var(--transition-normal),
        transform var(--transition-normal),
        box-shadow var(--transition-normal);
}

.login-button:hover {
    background: var(--color-0-hover) !important;
    border-color: var(--color-0-hover) !important;

    color: var(--color-black) !important;

    transform: translateY(-1px);

    box-shadow:
        0 8px 24px rgba(255, 107, 53, 0.15) !important;
}

.login-button:active {
    transform: translateY(0);
}

.login-button:focus-visible {
    box-shadow:
        0 0 0 3px rgba(255, 107, 53, 0.15) !important;
}

.login-button-arrow {
    font-size: 19px;

    transition: transform var(--transition-normal);
}

.login-button:hover .login-button-arrow {
    transform: translateX(3px);
}


/* =========================================================
   LOGIN ERROR
   ========================================================= */

.login-error {
    min-height: 20px;

    margin-top: 10px;

    color: var(--error-text-strong);

    font-size: 12px;
    line-height: 1.5;
}


/* =========================================================
   LOGIN FOOTER
   ========================================================= */

.login-footer {
    margin-top: 30px;
    padding-top: 20px;

    border-top: 1px solid var(--border-color);

    color: var(--text-muted);

    font-size: 11px;
    line-height: 1.5;

    text-align: center;
}

.login-footer strong {
    color: var(--text-secondary);
    font-weight: 600;
}


/* =========================================================
   PLOTLY
   ========================================================= */

.modebar-group {
    background-color: var(--surface-1) !important;
    border-radius: var(--radius-sm) !important;
}


/* =========================================================
   MOBILE — GENERAL
   ========================================================= */

@media (max-width: 768px) {

    .debate-message {
        grid-template-columns: 58px minmax(0, 1fr);
        column-gap: 12px;
    }

    .debate-message.right {
        grid-template-columns: minmax(0, 1fr) 58px;
    }

    .debate-avatar-wrapper {
        width: 58px;
        height: 58px;
    }

    .debate-avatar {
        width: 54px !important;
        height: 54px !important;

        min-width: 54px;
        min-height: 54px;
    }

    .message-bubble,
    .user-message-bubble {
        padding: 14px 15px;
    }

    .user-message-bubble {
        width: 88%;
    }

    .history-list {
        padding: 8px;
    }

    .history-button {
        padding: 10px 12px !important;
    }

    .program-card-body {
        min-height: 170px;
        padding: 16px !important;
    }

    .program-title {
        font-size: 16px;
    }

    .discussion-message-assistant .discussion-message-content,
    .discussion-message-debate-left .discussion-message-content,
    .discussion-message-debate-right .discussion-message-content {
        width: calc(100% - 70px);
    }

    .discussion-message-user {
        width: 85%;
    }
}

/* =========================================================
   POLICY OUTPUT
   ========================================================= */

.policy-output {
    display: flex;
    flex-direction: column;

    gap: 34px;

    width: 100%;
}


/* =========================================================
   OVERVIEW
   ========================================================= */

.policy-overview-card {
    position: relative;

    overflow: hidden;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;

    background: var(--surface-1) !important;

    box-shadow: var(--shadow-sm);
}

.policy-overview-card::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;

    width: 3px;
    height: 100%;

    background: var(--blue, var(--color-0));
}

.policy-overview-body {
    padding: 22px !important;
}

.policy-overview-label {
    margin-bottom: 10px;

    color: var(--text-secondary);

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.policy-overview-text {
    margin: 0;

    color: var(--text);

    font-size: 15px;
    line-height: 1.65;
}

.policy-overview-text p {
    margin-bottom: 0;
}


/* =========================================================
   PARTY SECTION
   ========================================================= */

.policy-party-section {
    display: flex;
    flex-direction: column;

    gap: 16px;
}

.policy-party-header {
    display: flex;
    align-items: center;

    gap: 9px;

    padding-bottom: 10px;

    border-bottom: 1px solid var(--border-color);
}

.policy-party-dot {
    width: 9px;
    height: 9px;

    flex: 0 0 auto;

    border-radius: 50%;

    background: var(--party-color);

    box-shadow:
        0 0 0 3px color-mix(
            in srgb,
            var(--party-color) 14%,
            transparent
        );
}

.policy-party-title {
    margin: 0;

    color: var(--text);

    font-size: 19px;
    font-weight: 600;

    letter-spacing: -0.015em;
}

.policy-party-acronym {
    margin-left: 2px;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;

    letter-spacing: 0.04em;
}


/* =========================================================
   POLICY CARD
   ========================================================= */

.policy-card {
    position: relative;

    overflow: hidden;

    height: 100%;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;

    background: var(--surface-1) !important;

    box-shadow: var(--shadow-sm);

    transition:
        transform var(--transition-normal),
        border-color var(--transition-normal),
        box-shadow var(--transition-normal);
}

.policy-card::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;

    width: 3px;
    height: 100%;

    background: var(--party-color);

    opacity: 0.55;

    transition:
        opacity var(--transition-normal),
        width var(--transition-normal);
}

.policy-card:hover {
    transform: translateY(-2px);

    border-color: var(--border-color-strong) !important;

    box-shadow: var(--shadow-md);
}

.policy-card:hover::before {
    width: 4px;

    opacity: 1;
}


/* =========================================================
   POLICY CARD BODY
   ========================================================= */

.policy-card-body {
    display: flex;
    flex-direction: column;

    min-height: 175px;

    padding: 17px !important;
}

.policy-card-content {
    display: flex;
    align-items: flex-start;

    gap: 12px;

    flex: 1;
}

.policy-card-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 27px;
    height: 27px;

    flex: 0 0 auto;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);

    background: var(--surface-2);

    color: var(--text-secondary);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.04em;
}

.policy-card-text {
    color: var(--text);

    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
}


/* =========================================================
   CARD FOOTER / SOURCE
   ========================================================= */

.policy-card-footer {
    display: flex;
    justify-content: flex-end;

    margin-top: 18px;
}

.policy-source-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    min-height: 32px;

    padding: 0 9px !important;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;

    background: var(--surface-2) !important;
    color: var(--text-secondary) !important;

    font-size: 11px !important;
    font-weight: 500 !important;

    text-decoration: none !important;

    box-shadow: none !important;

    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast);
}

.policy-source-button:hover {
    background: var(--surface-3) !important;

    border-color: var(--border-color-strong) !important;

    color: var(--text) !important;
}

.policy-source-label {
    white-space: nowrap;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.policy-empty-state {
    padding: 30px;

    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);

    color: var(--text-secondary);

    text-align: center;
}

/* =========================================================
   DISCUSSION STATUS
   ========================================================= */

.discussion-status-card {
    position: relative;

    overflow: hidden;

    width: 100%;

    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;

    background: var(--surface-1) !important;

    box-shadow: var(--shadow-sm);

    transition:
        border-color var(--transition-normal),
        box-shadow var(--transition-normal);
}

.discussion-status-card:hover {
    border-color: var(--border-color-strong) !important;

    box-shadow: var(--shadow-md);
}


/* =========================================================
   CARD BODY
   ========================================================= */

.discussion-status-card-body {
    padding: 22px !important;
}


/* =========================================================
   HEADER
   ========================================================= */

.discussion-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
}

.discussion-status-header-main {
    display: flex;
    align-items: center;

    gap: 12px;

    min-width: 0;
}


/* =========================================================
   STATUS ICON
   ========================================================= */

.discussion-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    flex: 0 0 auto;

    border: 1px solid var(--border-color);
    border-radius: 50%;

    background: var(--surface-2);

    font-size: 13px;
    font-weight: 700;

    transition:
        border-color var(--transition-normal),
        color var(--transition-normal),
        background-color var(--transition-normal);
}

.discussion-status-icon.discussion-status-active {
    border-color: color-mix(
        in srgb,
        var(--blue, var(--color-0)) 35%,
        var(--border-color)
    );

    background: color-mix(
        in srgb,
        var(--blue, var(--color-0)) 8%,
        var(--surface-2)
    );

    color: var(--blue, var(--color-0));

    animation: discussion-status-active 2s ease-in-out infinite;
}

@keyframes discussion-status-active {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.55;
    }
}

.discussion-status-icon.discussion-status-complete {
    border-color: color-mix(
        in srgb,
        #2bb673 35%,
        var(--border-color)
    );

    background: color-mix(
        in srgb,
        #2bb673 8%,
        var(--surface-2)
    );

    color: #2bb673;
}

.discussion-status-icon.discussion-status-pending {
    color: var(--text-secondary);
}


/* =========================================================
   STATUS HEADING
   ========================================================= */

.discussion-status-heading {
    min-width: 0;
}

.discussion-status-title {
    margin: 0;

    color: var(--text);

    font-size: 17px;
    font-weight: 600;

    letter-spacing: -0.015em;
}

.discussion-status-description {
    margin: 3px 0 0;

    color: var(--text-secondary);

    font-size: 12px;
    line-height: 1.45;
}


/* =========================================================
   COUNTER
   ========================================================= */

.discussion-status-count {
    display: flex;
    align-items: baseline;

    flex: 0 0 auto;

    color: var(--text-secondary);

    font-size: 13px;
    font-weight: 600;

    white-space: nowrap;
}

.discussion-status-count-current {
    color: var(--text);

    font-size: 15px;
    font-weight: 700;
}

.discussion-status-count-total {
    color: var(--text-secondary);
}


/* =========================================================
   PROGRESS BAR
   ========================================================= */

.discussion-status-progress {
    margin-top: 20px;
}

.discussion-status-progress-track {
    width: 100%;
    height: 5px;

    overflow: hidden;

    border-radius: var(--radius-pill);

    background: var(--surface-3);
}

.discussion-status-progress-fill {
    height: 100%;

    border-radius: var(--radius-pill);

    background: var(--blue, var(--color-0));

    transition: width var(--transition-normal);
}


/* =========================================================
   ACRONYM SECTION
   ========================================================= */

.discussion-progress-section {
    margin-top: 24px;
}

.discussion-progress-heading {
    margin-bottom: 9px;

    color: var(--text-secondary);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.discussion-progress-list {
    display: flex;
    flex-direction: column;

    gap: 5px;
}


/* =========================================================
   ACRONYM ROW
   ========================================================= */

.discussion-progress-item {
    display: flex;
    align-items: center;

    min-height: 42px;

    padding: 7px 10px;

    border: 1px solid transparent;
    border-radius: var(--radius-md);

    background: transparent;

    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast);
}

.discussion-progress-item-active {
    border-color: var(--border-color);

    background: var(--surface-2);
}

.discussion-progress-item-active:hover {
    border-color: var(--border-color-strong);
}

.discussion-progress-item-done {
    background: transparent;
}

.discussion-progress-item-pending {
    background: transparent;
}


/* =========================================================
   ACRONYM STATUS ICON
   ========================================================= */

.discussion-progress-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 25px;
    height: 25px;

    margin-right: 10px;

    flex: 0 0 auto;

    border: 1px solid var(--border-color);
    border-radius: 50%;

    font-size: 11px;
    font-weight: 700;

    transition:
        border-color var(--transition-fast),
        color var(--transition-fast),
        background-color var(--transition-fast);
}

.discussion-progress-icon-active {
    border-color: color-mix(
        in srgb,
        var(--blue, var(--color-0)) 45%,
        var(--border-color)
    );

    background: color-mix(
        in srgb,
        var(--blue, var(--color-0)) 8%,
        transparent
    );

    color: var(--blue, var(--color-0));

    animation: discussion-progress-active 2s ease-in-out infinite;
}

@keyframes discussion-progress-active {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.55;
    }
}

.discussion-progress-icon-done {
    border-color: color-mix(
        in srgb,
        #2bb673 45%,
        var(--border-color)
    );

    background: color-mix(
        in srgb,
        #2bb673 8%,
        transparent
    );

    color: #2bb673;
}

.discussion-progress-icon-pending {
    background: var(--surface-2);

    color: var(--text-secondary);
}


/* =========================================================
   PARTY INFORMATION
   ========================================================= */

.discussion-progress-party {
    display: flex;
    align-items: baseline;

    gap: 8px;

    flex: 1;

    min-width: 0;

    padding-left: 10px;

    border-left: 3px solid var(--party-color);
}

.discussion-progress-name {
    overflow: hidden;

    color: var(--text);

    font-size: 13px;
    font-weight: 500;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.discussion-progress-acronym {
    flex: 0 0 auto;

    color: var(--text-secondary);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.05em;
}


/* =========================================================
   STATUS LABEL
   ========================================================= */

.discussion-progress-label {
    flex: 0 0 auto;

    margin-left: 12px;

    font-size: 11px;
    font-weight: 500;

    white-space: nowrap;
}

.discussion-progress-label-active {
    color: var(--blue, var(--color-0));
}

.discussion-progress-label-done {
    color: #2bb673;
}

.discussion-progress-label-pending {
    color: var(--text-secondary);
}


/* =========================================================
   MOBILE — SMALL
   ========================================================= */

@media (max-width: 576px) {

    .discussion-offcanvas {
        width: 90% !important;
    }

    .discussion-messages {
        gap: 22px;
    }

    .discussion-message-assistant,
    .discussion-message-debate-left,
    .discussion-message-debate-right {
        gap: 10px;
    }

    .discussion-message-assistant .party-avatar,
    .discussion-message-debate-left .party-avatar,
    .discussion-message-debate-right .party-avatar {
        width: 48px !important;
        height: 48px !important;
    }

    .discussion-message-assistant .discussion-message-content,
    .discussion-message-debate-left .discussion-message-content,
    .discussion-message-debate-right .discussion-message-content {
        width: calc(100% - 58px);
    }

    .discussion-message-user {
        width: 92%;
    }

    .page-title {
        font-size: 20px;
    }

    .message-row {
        margin-bottom: 18px;
    }

    .message-bubble {
        border-radius: 12px;
    }

    .program-card-body {
        min-height: 190px;
    }

    .login-page {
        padding: 20px 16px;
    }

    .login-card {
        padding: 32px 24px 26px;
        border-radius: 16px;
    }

    .login-brand {
        margin-bottom: 38px;
    }

    .login-heading h1 {
        font-size: 32px;
    }

    .speaker-name,
    .speaker-party {
        display: block;
    }

    .speaker-label {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    /* Left-side candidate */
    .discussion-message-debate-left .speaker-label {
        align-items: flex-start;
        text-align: left;
    }

    /* Right-side candidate */
    .discussion-message-debate-right .speaker-label {
        align-items: flex-end;
        text-align: right;
    }

    .speaker-name,
    .speaker-party {
        display: block;
    }

    .success-toast {
        background: rgba(43, 182, 115, 0.8);
        width: calc(100% - 32px);
        max-width: 400px;
    }

    .success-toast .toast-header {
        background: rgba(43, 182, 115, 0.8);
    }

 .discussion-status-card-body {
        padding: 17px !important;
    }

    .discussion-status-header {
        align-items: flex-start;

        gap: 12px;
    }

    .discussion-status-header-main {
        gap: 9px;
    }

    .discussion-status-icon {
        width: 30px;
        height: 30px;
    }

    .discussion-status-title {
        font-size: 15px;
    }

    .discussion-status-description {
        font-size: 11px;
    }

    .discussion-status-count {
        font-size: 12px;
    }

    .discussion-status-count-current {
        font-size: 14px;
    }

    .discussion-progress-item {
        min-height: 40px;

        padding: 7px 8px;
    }

    .discussion-progress-name {
        font-size: 12px;
    }

    .discussion-progress-acronym {
        font-size: 9px;
    }

    .discussion-progress-label {
        font-size: 10px;
    }

    .discussion-progress-party {
        gap: 5px;
    }
}


/* =========================================================
   CUSTOM SCROLLBAR
   ========================================================= */

.custom-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--color-0) transparent;
}

.custom-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: var(--color-0);

    border-radius: var(--radius-pill);
    border: 2px solid transparent;

    background-clip: padding-box;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--color-0-hover);
    background-clip: padding-box;
}

.custom-scroll::-webkit-scrollbar-corner {
    background: transparent;
}