:root {
    --bg: #f0f2f8;
    --bg-accent: #e8ecf8;
    --surface: #ffffff;
    --surface-soft: #f6f8fd;
    --text: #151d2e;
    --muted: #5a6880;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.22);
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --border: #dde3f0;
    --sidebar-bg: #0f1629;
    --sidebar-accent: #1e2a48;
    --shadow-soft: 0 4px 20px rgba(15, 23, 42, 0.07);
    --shadow-card: 0 8px 28px rgba(15, 23, 42, 0.09);
    --radius: 16px;
    --radius-sm: 10px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    display: flex;
    line-height: 1.55;
}

h1,
h2,
h3 {
    color: #0d1526;
    margin-top: 0;
    letter-spacing: -0.01em;
    font-weight: 700;
}

h1 {
    text-align: left;
    margin-bottom: 6px;
    font-size: clamp(1.4rem, 1.8vw, 1.9rem);
    font-weight: 800;
}

.subtitle {
    color: var(--muted);
    font-size: 0.93rem;
    margin-bottom: 24px;
    margin-top: 4px;
}

p {
    color: var(--text);
}

a {
    color: inherit;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 240px;
    height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,0.06);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.28);
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 22px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.sidebar-brand-name {
    display: block;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.sidebar-brand-tagline {
    display: block;
    color: rgba(255,255,255,0.38);
    font-size: 0.73rem;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-nav {
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.sidebar a {
    color: rgba(255,255,255,0.65);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    width: 100%;
    border-radius: var(--radius-sm);
    text-align: left;
    padding: 10px 14px;
    transition: background 0.15s ease, color 0.15s ease;
    display: block;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(79, 70, 229, 0.2);
    color: #c4bfff;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-footer a {
    color: rgba(255,255,255,0.4);
    font-size: 0.85rem;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    display: block;
    transition: background 0.15s, color 0.15s;
}

.sidebar-footer a:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
}

.username {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
}

/* La sidebar n'est rendue que pour les utilisateurs connectés (cf. template Jinja2) */

.content {
    margin-left: 240px;
    width: calc(100% - 240px);
    min-height: 100vh;
    padding: 32px 36px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-x: hidden;
}

/* Pages sans sidebar (login, reset password…) */
body[data-user-id="0"] .content {
    margin-left: 0;
    width: 100%;
    justify-content: center;
    padding: 24px;
}

.container,
.container-login {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 32px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    animation: surface-enter 0.28s ease-out;
}

.container-login {
    max-width: 480px;
    margin-top: 48px;
}

.alert-container {
    margin: 16px 0;
    text-align: center;
}

.alert {
    display: block;
    width: min(100%, 740px);
    margin: 0 auto 12px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 700;
}

.alert-success {
    background: #e9f9f2;
    color: #0f6b4a;
    border-color: #bcefd7;
}

.alert-danger {
    background: #ffedf0;
    color: #992733;
    border-color: #ffc6cf;
}

.alert-warning {
    background: #fff7e5;
    color: #8a5b11;
    border-color: #ffe6b8;
}

.alert-info {
    background: #e8f3ff;
    color: #14509e;
    border-color: #c5defe;
}

#progressBar {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, #2682f5, #4cc2ff);
    transition: width 0.4s ease;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label,
label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: #223252;
}

.form-control,
.form-group input[type="file"],
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group select,
.search-container input[type="text"],
.liste_users input[type="password"],
.liste_users input[type="number"],
.liste_users input[type="text"],
.liste_users input[type="email"],
input[type="number"],
select,
.segment-text {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    background: #ffffff;
    color: var(--text);
    font-size: 0.96rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input[type="file"] {
    padding: 8px;
    border-style: dashed;
    border-width: 1.5px;
    border-color: #afc5e8;
    background:
        linear-gradient(130deg, #ffffff, #f6f9ff);
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: #7fa8e9;
    background: linear-gradient(130deg, #ffffff, #eef4ff);
}

input[type="file"]::file-selector-button {
    border: 0;
    border-radius: 10px;
    padding: 9px 14px;
    margin-right: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #1f6feb, #2e99f5);
    cursor: pointer;
    transition: filter 0.18s ease, transform 0.18s ease;
}

input[type="file"]::file-selector-button:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

input[type="file"]::-webkit-file-upload-button {
    border: 0;
    border-radius: 10px;
    padding: 9px 14px;
    margin-right: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #1f6feb, #2e99f5);
    cursor: pointer;
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23475a7c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #7fb1ff;
    box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.14);
}

.form-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.form-check-label {
    margin: 0;
    font-weight: 700;
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
}

.form-text.text-muted,
.text-muted {
    color: var(--muted);
    font-size: 0.86rem;
}

button,
.btn,
.search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    min-height: 40px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    margin-top: 8px;
    color: #fff;
    background: var(--primary);
    transition: background 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
}

button:hover,
.btn:hover,
.search-button:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px var(--primary-glow);
}

button:active,
.btn:active {
    opacity: 0.9;
}

button:disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary {
    background: var(--primary);
}

.btn-success {
    background: #059669;
}
.btn-success:hover { background: #047857; }

.btn-warning {
    color: #1a0e00;
    background: #f59e0b;
}
.btn-warning:hover { background: #d97706; }

.btn-danger {
    background: #dc2626;
}
.btn-danger:hover { background: #b91c1c; }

.btn-secondary {
    color: #e2e8f0;
    background: #334155;
    border-color: rgba(255,255,255,0.08);
}
.btn-secondary:hover { background: #475569; }

.btn-download {
    background: var(--primary);
}

.btn-pagination {
    min-width: 42px;
    margin: 4px;
}

.btn-pagination.active {
    background: linear-gradient(135deg, #0f2f6f, #184694);
}

.retour-btn {
    margin-right: 8px;
    margin-top: 0;
}

.btn-sm {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.84rem;
}

.full-width {
    width: 100%;
}

.forgot-password {
    margin-top: 14px;
    text-align: center;
}

.forgot-password a {
    color: #225dca;
    font-weight: 700;
    text-decoration: none;
}

.forgot-password a:hover {
    text-decoration: underline;
}

.search-container {
    margin-bottom: 16px;
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 220px;
}

.search-select-wrapper {
    position: relative;
    display: inline-block;
}

.search-select-wrapper::after {
    content: "";
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form select {
    max-width: 220px;
}

.table-container {
    overflow-x: auto;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    padding: 12px;
}

table,
.responsive-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

th,
td,
.responsive-table th,
.responsive-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e8edf4;
    text-align: left;
    vertical-align: top;
    word-wrap: break-word;
}

th,
.responsive-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #eff4ff;
    background: linear-gradient(135deg, #2d446f, #3c588c);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.79rem;
}

tr:nth-of-type(even) {
    background: #fbfdff;
}

tr:hover {
    background: #f2f7ff;
}

.email-cell {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.transcriptions-container {
    display: grid;
    gap: 18px;
}

.transcription-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    padding: 20px 22px;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
    position: relative;
}

.transcription-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.18s;
}

.transcription-item:hover {
    border-color: #c5cadc;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.transcription-item:hover::before {
    opacity: 1;
}

.transcription-item h3 {
    margin-bottom: 4px;
    font-size: 1rem;
}

.transcription-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 6px 0 14px;
}

.transcription-meta span {
    font-size: 0.82rem;
    color: var(--muted);
}

.transcription-item p {
    margin: 3px 0;
    color: var(--muted);
    font-size: 0.87rem;
}

.transcription-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 14px;
}

.custom-hr {
    display: none;
}

.transcription-preview {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
    margin: 8px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 2.8em;
}

.assign-speakers-panel,
.document-panel {
    margin-top: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-soft);
    box-shadow: 0 2px 12px rgba(15,23,42,0.05);
    animation: panel-appear 0.22s ease-out;
}

/* ── Locuteurs mémorisés ── */
.known-speakers-suggestions {
    margin-bottom: 14px;
}

.known-speakers-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin: 0 0 8px;
}

.known-speakers-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.known-speaker-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 13px;
    border: 1.5px solid rgba(79, 70, 229, 0.3);
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.06);
    color: var(--primary);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0;
    min-height: 30px;
    transition: background 0.14s, border-color 0.14s, color 0.14s;
    box-shadow: none;
}

.known-speaker-chip:hover {
    background: rgba(79, 70, 229, 0.14);
    border-color: var(--primary);
    color: var(--primary-hover);
    box-shadow: none;
}

/* ── Page gestion des locuteurs ── */
.speakers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.speaker-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    gap: 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.speaker-card:hover {
    border-color: #bec5d8;
    box-shadow: 0 4px 16px rgba(15,23,42,0.1);
}

.speaker-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.speaker-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.speaker-meta {
    font-size: 0.78rem;
    color: var(--muted);
}

.empty-state {
    margin-top: 32px;
    text-align: center;
    color: var(--muted);
    padding: 40px 20px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state p {
    color: var(--muted);
    margin: 6px 0;
}

/* ── Speaker ID label (remplacement du readonly input) ── */
.speaker-id-label {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.84rem;
    white-space: nowrap;
}

.assign-speakers-status,
.document-status {
    margin: 0 0 10px;
    font-weight: 700;
    color: #2b4066;
}

.speaker-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #dbe5f4;
    background: #ffffff;
    align-items: center;
}

.speaker-row input[readonly] {
    border: 0;
    border-radius: 10px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #ecf3ff, #dfeafe);
    color: #23416f;
    font-weight: 800;
    text-align: center;
}

.assign-speaker-name {
    font-weight: 600;
}

.assign-speakers-form {
    margin-top: 6px;
}

.assign-speakers-form .btn {
    margin-top: 4px;
}

.assign-speakers-btn {
    background: linear-gradient(135deg, #2553a2, #3d78db);
}

.document-editor {
    display: grid;
    gap: 10px;
}

.segment-row {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 10px;
    align-items: start;
}

.segment-speaker {
    font-weight: 800;
    color: #213250;
    padding-top: 10px;
    word-break: break-word;
}

.segment-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.segment-text {
    min-height: 86px;
    resize: vertical;
    font-family: inherit;
}

.document-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

/* ── list_users — identité utilisateur ── */
.user-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.user-identity-name {
    font-weight: 700;
    font-size: 0.97rem;
    color: var(--text);
}

.user-identity-email {
    font-size: 0.82rem;
    color: var(--muted);
}

.user-edit-form {
    margin-bottom: 6px;
}

/* ── list_users phase 2 — mode lecture / édition ── */

/* Bouton discret pour déclencher l'édition */
.btn-ghost {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid rgba(79, 70, 229, 0.35);
    padding: 4px 12px;
    min-height: 28px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 6px;
}
.btn-ghost:hover {
    background: rgba(79, 70, 229, 0.07);
    border-color: var(--primary);
    box-shadow: none;
}

/* Bouton Annuler */
.btn-cancel {
    background: transparent;
    color: var(--muted);
    border: 1.5px solid var(--border);
    padding: 4px 12px;
    min-height: 28px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
}
.btn-cancel:hover {
    background: #f1f5f9;
    color: var(--text);
    box-shadow: none;
}

/* Animation d'entrée pour le mode édition */
.edit-view {
    animation: panel-appear 0.16s ease-out;
}

/* Valeur lisible de collectivité */
.collectivite-read {
    display: block;
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 2px;
}

/* Valeurs lisibles des quotas */
.quota-read {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    row-gap: 3px;
    align-items: baseline;
    margin-bottom: 4px;
}
.quota-read-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.quota-read-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
}

/* ── list_users — badge rôle ── */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
}

.role-badge-admin {
    background: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

.role-badge-user {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* ── list_users phase 3 — quotas compacts ── */
.quota-compact {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 4px;
}
.quota-main {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.quota-sub {
    font-size: 0.77rem;
    color: var(--muted);
}
.quota-sub strong {
    color: var(--text);
    font-weight: 600;
}

/* ── list_users phase 3 — statut admin ── */
.admin-status-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.btn-admin-toggle {
    font-size: 0.77rem;
    padding: 3px 10px;
    min-height: 26px;
    color: var(--muted);
    border-color: var(--border);
}
.btn-admin-toggle:hover {
    color: var(--text);
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

/* ── list_users phase 3 — colonne actions ── */
.action-password-section {
    margin-bottom: 0;
}
.password-form {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: panel-appear 0.14s ease-out;
}
.password-form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
}
.password-form-actions {
    display: flex;
    gap: 6px;
}
.action-delete-section {
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
}
.btn-delete-user {
    font-size: 0.82rem;
    padding: 4px 14px;
    width: auto;
}

/* ── list_users — infos quotas ── */
.quota-info {
    margin: 5px 0 0;
    font-size: 0.83rem;
    color: var(--muted);
}

.quota-info strong {
    color: var(--text);
    font-weight: 700;
}

/* ── list_users — espacement cellules ── */
.liste_users td {
    padding: 14px 12px;
    vertical-align: top;
}

.is_admin {
    margin-left: 10px;
}

.block_is_admin {
    display: flex;
    align-items: center;
}

.spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid #cfe0ff;
    border-top-color: #1f6feb;
    animation: spin 0.8s linear infinite;
    margin: 18px auto 0;
}

.hidden {
    display: none;
}

/* ── Section blocks (manage_collectivites) ── */
.section-block {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.section-block:first-of-type {
    margin-top: 8px;
    padding-top: 0;
    border-top: none;
}

.section-block-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}

.form-add-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.form-add-row .form-control {
    flex: 1;
    min-width: 200px;
    width: auto;
    margin: 0;
}

.form-add-row .btn {
    margin-top: 0;
    flex-shrink: 0;
}

.collectivite-delete-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.btn-ghost-danger {
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.3);
}

.btn-ghost-danger:hover {
    background: rgba(220, 38, 38, 0.06);
    border-color: var(--danger);
    box-shadow: none;
}

.delete-warning {
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--danger);
    margin: 0 0 6px;
}

.delete-confirm-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Admin dashboard grid ── */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.admin-card {
    padding: 22px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
}

.admin-card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.admin-card-desc {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0 0 20px;
    flex: 1;
}

.admin-card .btn {
    margin-top: 0;
    align-self: flex-start;
}

/* ── Page transcription (index) ── */
.upload-block {
    margin: 24px 0 20px;
    padding: 20px 22px;
    border: 1.5px dashed #afc5e8;
    border-radius: var(--radius);
    background: linear-gradient(130deg, #ffffff, #f6f9ff);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-block:hover,
.upload-block:focus-within {
    border-color: #7fb1ff;
    background: linear-gradient(130deg, #ffffff, #eef4ff);
}

.upload-block-label {
    display: block;
    font-weight: 700;
    color: #223252;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.upload-block input[type="file"] {
    border: none;
    background: transparent;
    padding: 4px 0;
    width: 100%;
}

.upload-hint {
    margin: 10px 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.btn-transcribe {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-top: 0;
}

@media (max-width: 980px) {
    .admin-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .admin-grid { grid-template-columns: 1fr; }
    .form-add-row { flex-direction: column; align-items: stretch; }
    .form-add-row .btn { width: 100%; }
}

@keyframes panel-appear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes surface-enter {
    from {
        opacity: 0.92;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@media (max-width: 1200px) {
    .container { max-width: 100%; }
}

@media (max-width: 1024px) {
    .sidebar { width: 200px; }
    .content {
        margin-left: 200px;
        width: calc(100% - 200px);
        padding: 20px;
    }
    .container, .container-login { padding: 22px; }
}

@media (max-width: 768px) {
    body { display: block; }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
        gap: 6px;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.07);
    }

    .sidebar-brand { border-bottom: none; padding: 6px 8px; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 0; }
    .sidebar-footer { border-top: none; padding: 0; }

    .content {
        margin: 0;
        width: 100%;
        padding: 14px;
    }

    .container, .container-login {
        margin-top: 12px;
        padding: 16px;
        border-radius: var(--radius);
    }

    .responsive-table thead { display: none; }

    .responsive-table tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        overflow: hidden;
        background: #fff;
    }

    .responsive-table td {
        display: block;
        text-align: left;
        padding: 10px 12px;
        border-bottom: 1px solid #eef2f8;
    }

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 3px;
        font-size: 0.76rem;
        font-weight: 700;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .btn { width: 100%; }

    .speaker-row,
    .segment-row {
        grid-template-columns: 1fr;
    }
}
