html, body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
}

.content {
    padding: 1rem;
}

.loading-progress {
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    text-align: center;
    font-weight: bold;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Chargement");
}

#blazor-error-ui {
    background: #ffd9d9;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

/* --- écrans d'authentification --- */
.auth-card {
    max-width: 22rem;
    margin: 10vh auto;
    padding: 1.5rem;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 0.5rem;
}

.auth-card h1 {
    margin: 0;
    font-size: 1.6rem;
}

.auth-subtitle {
    margin: 0.25rem 0 1.25rem 0;
    opacity: 0.7;
}

.auth-hint {
    font-size: 0.85rem;
    opacity: 0.7;
}

.auth-error {
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    background: #ffd9d9;
    color: #7a0000;
}

.form-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.9rem;
}

.form-field label {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.form-field input {
    padding: 0.55rem;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 0.25rem;
    font-size: 1rem;
}

.auth-card button[type="submit"],
.auth-card button[type="button"] {
    width: 100%;
    padding: 0.6rem;
    border: none;
    border-radius: 0.25rem;
    background: #1b6ec2;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.auth-card button:disabled {
    opacity: 0.6;
    cursor: default;
}

.spacer { flex: 1; }

.username { font-size: 0.85rem; opacity: 0.8; margin-right: 0.75rem; }

.link-button {
    background: none;
    border: none;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
}

/* --- idées --- */
.app-title { font-weight: 600; text-decoration: none; color: inherit; margin-right: 1rem; }
.nav-link { text-decoration: none; color: inherit; opacity: 0.85; }

.search-bar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.search-bar input {
    flex: 1;
    padding: 0.55rem;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 0.25rem;
    font-size: 1rem;
}

.folder-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.folder-button {
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(128, 128, 128, 0.4);
    border-radius: 1rem;
    background: none;
    color: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}
.folder-button.selected { background: #1b6ec2; color: #fff; border-color: #1b6ec2; }
.folder-button .count { opacity: 0.6; margin-left: 0.3rem; }

.idea-list { list-style: none; padding: 0; margin: 0; }
.idea-list li { border-bottom: 1px solid rgba(128, 128, 128, 0.2); }
.idea-list a {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.7rem 0.2rem;
    text-decoration: none;
    color: inherit;
}
.idea-title { font-weight: 600; }
.idea-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; font-size: 0.75rem; }

.badge {
    padding: 0.1rem 0.45rem;
    border-radius: 0.8rem;
    border: 1px solid rgba(128, 128, 128, 0.4);
    opacity: 0.85;
}
.badge.draft { background: #ffe8b3; color: #6b4b00; border-color: transparent; }
.badge.tag { background: rgba(27, 110, 194, 0.15); border-color: transparent; }
.date { opacity: 0.6; margin-left: auto; }

.breadcrumb { font-size: 0.8rem; opacity: 0.75; }
.idea-body pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    line-height: 1.55;
}
.revision-notice {
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    background: rgba(255, 232, 179, 0.5);
    font-size: 0.85rem;
}

.history { list-style: none; padding: 0; }
.history li {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
    font-size: 0.85rem;
}
.history-message { flex: 1; }
.empty { opacity: 0.7; font-style: italic; }

/* --- capture éclair --- */
.capture-heading { margin-bottom: 0.6rem; }
.capture textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 0.35rem;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
}
.capture-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}
.capture-actions .primary {
    padding: 0.5rem 1.1rem;
    border: none;
    border-radius: 0.25rem;
    background: #1b6ec2;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}
.capture-actions .primary:disabled { opacity: 0.5; cursor: default; }
.capture-hint { font-size: 0.75rem; opacity: 0.55; }
.capture-message { font-size: 0.85rem; }
.capture-message.ok { color: #1a7f37; }
.capture-message.error { color: #b3261e; }
.home-links { display: flex; align-items: center; gap: 0.6rem; margin-top: 2rem; }

/* --- édition et propositions --- */
.notice {
    padding: 0.55rem 0.8rem;
    border-radius: 0.3rem;
    background: rgba(27, 110, 194, 0.12);
    font-size: 0.85rem;
}
.notice.draft-notice { background: rgba(255, 200, 60, 0.22); }

.form-field select,
.form-field textarea {
    padding: 0.55rem;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 0.25rem;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}
.form-field textarea { line-height: 1.5; resize: vertical; }

.detail-header { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.primary-link { font-weight: 600; }

.pending-badge {
    display: inline-block;
    min-width: 1.1rem;
    padding: 0 0.3rem;
    margin-left: 0.3rem;
    border-radius: 0.6rem;
    background: #d13438;
    color: #fff;
    font-size: 0.7rem;
    text-align: center;
}

.change { margin: 1.5rem 0; }
.change h2 { font-size: 0.95rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.badge.action-move { background: rgba(255, 200, 60, 0.3); border-color: transparent; }
.badge.action-update { background: rgba(27, 110, 194, 0.18); border-color: transparent; }
.badge.action-create { background: rgba(26, 127, 55, 0.18); border-color: transparent; }
.badge.action-delete { background: rgba(209, 52, 56, 0.18); border-color: transparent; }

/* Le diff scrolle dans son propre conteneur : la page ne doit jamais partir en travers. */
.diff { border: 1px solid rgba(128, 128, 128, 0.3); border-radius: 0.3rem; overflow: hidden; }
.diff-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(128, 128, 128, 0.12);
}
.diff-header span { padding: 0.35rem 0.6rem; }
.diff-body { display: grid; grid-template-columns: 1fr 1fr; overflow-x: auto; }
.diff-side { border-right: 1px solid rgba(128, 128, 128, 0.2); min-width: 0; }
.diff-line { display: flex; font-family: ui-monospace, monospace; font-size: 0.8rem; line-height: 1.45; }
.diff-num {
    flex: 0 0 2.4rem;
    padding-right: 0.5rem;
    text-align: right;
    opacity: 0.4;
    user-select: none;
}
.diff-text { white-space: pre-wrap; word-break: break-word; min-width: 0; }
.diff-line.added { background: rgba(26, 127, 55, 0.18); }
.diff-line.removed { background: rgba(209, 52, 56, 0.16); }
.diff-line.modified { background: rgba(255, 200, 60, 0.22); }
.diff-line.empty { background: rgba(128, 128, 128, 0.07); }

@media (max-width: 700px) {
    .diff-body, .diff-header { grid-template-columns: 1fr; }
}

/* Espacement des liens de la barre : sans cela « Idées » et « Propositions » se collent. */
.nav-link { margin-right: 1rem; display: inline-flex; align-items: center; }

/* --- assistant --- */
.assist-output {
    border-left: 3px solid #1b6ec2;
    padding-left: 0.8rem;
    margin-top: 1rem;
}
.badge.tag.new { background: rgba(26, 127, 55, 0.22); font-weight: 600; }
.suggestion {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.2rem;
}
.suggestion .idea-title { flex: 0 0 auto; }
.suggestion a { margin-left: auto; }

.reasoning {
    margin-top: 1rem;
    padding: 0.5rem 0.8rem;
    border-radius: 0.3rem;
    background: rgba(128, 128, 128, 0.1);
    font-size: 0.8rem;
    opacity: 0.75;
}
.reasoning summary { cursor: pointer; font-weight: 600; }
.reasoning pre { white-space: pre-wrap; word-break: break-word; margin: 0.5rem 0 0 0; }

.persona-picker { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; }
.persona-picker label { font-size: 0.85rem; opacity: 0.8; }
.persona-picker select {
    padding: 0.4rem;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 0.25rem;
    font-family: inherit;
}
.persona-description { font-size: 0.8rem; opacity: 0.7; }

.thinking-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; margin-bottom: 1rem; }
.thinking-toggle input { width: 1rem; height: 1rem; }
.thinking-hint { opacity: 0.55; font-size: 0.75rem; }

/* --- réglages de l'assistant --- */
.assist-settings {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.9rem;
    margin: 1rem 0;
    padding: 0.7rem;
    border: 1px solid rgba(128, 128, 128, 0.25);
    border-radius: 0.35rem;
}
.setting { display: flex; flex-direction: column; gap: 0.2rem; }
.setting label { font-size: 0.72rem; opacity: 0.7; }
.setting select, .setting input {
    padding: 0.35rem;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 0.25rem;
    font-family: inherit;
    font-size: 0.85rem;
}
.setting input[type="number"] { width: 6.5rem; }
.assist-settings .thinking-toggle { margin-bottom: 0.35rem; }

/* --- conversation --- */
.chat { display: flex; flex-direction: column; gap: 0.8rem; margin: 1rem 0; }
.chat-message { display: flex; flex-direction: column; gap: 0.15rem; max-width: 46rem; }
.chat-message.from-user { align-self: flex-end; align-items: flex-end; }
.chat-role { font-size: 0.68rem; opacity: 0.55; }
.chat-body {
    padding: 0.55rem 0.8rem;
    border-radius: 0.6rem;
    background: rgba(128, 128, 128, 0.12);
}
.chat-message.from-user .chat-body { background: rgba(27, 110, 194, 0.16); }
.chat-body pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; margin: 0; line-height: 1.5; }
.chat-input textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 0.3rem;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    box-sizing: border-box;
}

/* --- actions combinables --- */
.action-toggles { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; }
.action-toggle {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid rgba(128, 128, 128, 0.4);
    border-radius: 0.35rem;
    cursor: pointer;
}
.action-toggle.on { border-color: #1b6ec2; background: rgba(27, 110, 194, 0.1); }
.action-label { font-weight: 600; font-size: 0.9rem; }
.action-help { font-size: 0.75rem; opacity: 0.6; }

.result-editor {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid rgba(128, 128, 128, 0.5);
    border-radius: 0.3rem;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.55;
    resize: vertical;
    box-sizing: border-box;
}

/* --- pièces jointes --- */
.attachments { list-style: none; padding: 0; }
.attachments li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
    font-size: 0.9rem;
}
.attachment-preview {
    max-width: 4rem;
    max-height: 4rem;
    border-radius: 0.2rem;
    object-fit: cover;
    display: block;
}

/* --- administration des comptes --- */
.users { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.users th, .users td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid rgba(128, 128, 128, 0.2); }
.users th { font-size: 0.75rem; text-transform: uppercase; opacity: 0.6; }
.users tr.disabled { opacity: 0.5; }
.link-button.danger { color: #b3261e; font-weight: 600; }

/* --- connexion par fournisseur d'identité --- */
.oidc-button {
    display: block;
    padding: 0.6rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
    background: #2b2b40;
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 0.95rem;
}
.oidc-separator {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.8rem 0;
    font-size: 0.75rem;
    opacity: 0.5;
}
.oidc-separator::before, .oidc-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(128, 128, 128, 0.4);
}

.redirect-uri { display: block; padding: 0.4rem 0.6rem; background: rgba(128,128,128,0.12); border-radius: 0.25rem; font-size: 0.8rem; word-break: break-all; }
