:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: #111827;
    --muted: #6b7280;
    --border: #d9dee7;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #15803d;
    --warning: #b45309;
    --info: #0369a1;
    --radius: 14px;
    --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

/* ==========================================================
   Base
   ========================================================== */

* {
    box-sizing: border-box;
}

html {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.page {
    padding: 28px 0;
}

main.page > section {
    margin-bottom: 28px;
}

main.page > section:last-child {
    margin-bottom: 0;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.card + .card {
    margin-top: 16px;
}

h1,
h2,
h3 {
    margin-top: 0;
    line-height: 1.2;
}

h1 {
    font-size: 1.8rem;
}

h2 {
    font-size: 1.35rem;
}

h3 {
    font-size: 1.1rem;
}

.muted,
.meta {
    color: var(--muted);
}

.meta {
    font-size: 0.92rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ==========================================================
   Header
   ========================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.site-header-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    flex: 0 0 auto;
    max-width: 180px;
    line-height: 1.1;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
}

.main-nav {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    padding: 8px 0;
}

.main-nav a {
    flex: 0 0 auto;
    color: var(--text);
    padding: 8px 11px;
    border-radius: 999px;
    font-size: 0.95rem;
    line-height: 1;
}

.main-nav a:hover {
    background: #eef2f7;
    text-decoration: none;
}

.main-nav a[href*="admin"] {
    background: #111827;
    color: #ffffff;
}

.main-nav a[href*="logout"] {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ==========================================================
   Formulaires
   ========================================================== */

label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-weight: 650;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(37, 99, 235, 0.18);
    border-color: var(--primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    font-weight: 650;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

/* ==========================================================
   Boutons
   ========================================================== */

button,
.button,
.button-primary,
.button-secondary,
.button-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}

button:hover,
.button:hover,
.button-primary:hover,
.button-secondary:hover,
.button-danger:hover {
    text-decoration: none;
}

.button-primary,
button[type="submit"] {
    background: var(--primary);
    color: #fff;
}

.button-primary:hover,
button[type="submit"]:hover {
    background: var(--primary-dark);
}

.button-secondary,
.button {
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid var(--border);
}

.button-secondary:hover,
.button:hover {
    background: #eef2f7;
}

.button-danger {
    background: var(--danger);
    color: #fff;
}

button[data-publish-mastodon] {
    background: #f5f3ff;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
}

button[data-publish-mastodon]:hover {
    background: #ede9fe;
}

/* ==========================================================
   Messages flash
   ========================================================== */

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    margin: 14px 0;
    border: 1px solid transparent;
}

.flash ul {
    margin-bottom: 0;
}

.flash-success {
    background: #ecfdf5;
    color: var(--success);
    border-color: #bbf7d0;
}

.flash-error {
    background: #fef2f2;
    color: var(--danger);
    border-color: #fecaca;
}

.flash-warning {
    background: #fffbeb;
    color: var(--warning);
    border-color: #fde68a;
}

.flash-info {
    background: #eff6ff;
    color: var(--info);
    border-color: #bfdbfe;
}

/* ==========================================================
   Grilles
   ========================================================== */

.grid {
    display: grid;
    gap: 16px;
}

.grid > .card {
    min-width: 0;
}

.grid > .card + .card {
    margin-top: 0;
}

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

.admin-latest-grid {
    align-items: stretch;
}

.admin-latest-grid > .card {
    height: 100%;
}

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

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
}

.grid-4 > .card {
    height: 100%;
}

/* ==========================================================
   Dashboard
   ========================================================== */

.dashboard-grid {
    margin: 18px 0;
}

.dashboard-grid.grid-4 > .dashboard-card {
    box-sizing: border-box;
    height: 220px;
    min-height: 220px;
    max-height: 220px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    align-items: stretch;
    margin: 0;
}

.dashboard-grid .dashboard-card h2 {
    margin: 0;
}

.dashboard-grid .dashboard-card .stat {
    margin: 0;
    align-self: center;
    line-height: 1;
}

.dashboard-grid .dashboard-card .muted {
    margin: 0;
    align-self: end;
}

.stat {
    font-size: 2rem;
    font-weight: 800;
}

.dashboard-latest-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 28px;
}

.dashboard-latest-grid > .card {
    display: flex;
    flex-direction: column;
    margin: 0;
    height: 100%;
    min-height: 360px;
    align-self: stretch;
}

.dashboard-latest-grid > .card > h2 {
    margin-top: 0;
}

.dashboard-latest-grid .post,
.dashboard-latest-grid .article-preview {
    flex: 0 0 auto;
    margin-bottom: 14px;
}

.dashboard-latest-grid .article-preview {
    max-height: 230px;
    overflow: hidden;
}

.dashboard-latest-grid .article-preview-summary {
    max-height: 95px;
    overflow: hidden;
}

.dashboard-latest-grid .article-preview-summary p {
    margin-bottom: 0.35em;
}

.dashboard-latest-grid .article-preview h3 {
    margin-bottom: 10px;
}

.dashboard-latest-grid .article-preview .meta {
    margin-top: 12px;
}

/* ==========================================================
   Tableaux
   ========================================================== */

.table-wrapper {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.admin-recent-users-table table {
    table-layout: fixed;
}

.admin-recent-users-table th,
.admin-recent-users-table td {
    overflow-wrap: anywhere;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface-muted);
    font-weight: 800;
}

tr:last-child td {
    border-bottom: 0;
}

/* ==========================================================
   Badges
   ========================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.badge-admin {
    background: #eef2ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

.badge-user,
.badge-active {
    background: #ecfdf5;
    color: #166534;
    border-color: #bbf7d0;
}

.badge-disabled {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* ==========================================================
   Posts, articles, accueil publique
   ========================================================== */

.feed-list,
.article-list,
.group-list,
.notifications-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.post,
.article-preview,
.message,
.group-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.article-preview h2,
.article-preview h3,
.post h3 {
    margin-top: 0;
    margin-bottom: 8px;
}

.article-preview p:first-child,
.post p:first-child {
    margin-top: 0;
}

.post-header,
.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.post-header-right,
.article-preview-header,
.article-title-row,
.message-author-row,
.user-cell,
.profile-avatar-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.post-header-right,
.article-title-row .post-avatar,
.article-preview-header .post-avatar,
.message-author-row .post-avatar {
    flex: 0 0 auto;
}

.article-preview-header,
.article-title-row,
.message-author-row {
    justify-content: space-between;
}

.article-preview-header h2,
.article-preview-header h3,
.article-title-row h1 {
    margin: 0;
}

.profile-avatar-block {
    align-items: flex-start;
    margin-bottom: 22px;
}

.profile-avatar-block form {
    flex: 1;
}

.post-content {
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: normal;
}

.post-content.markdown-content p,
.message-content.markdown-content p {
    margin: 0 0 0.65em;
}

.post-content.markdown-content p:last-child,
.message-content.markdown-content p:last-child {
    margin-bottom: 0;
}

.message-content.markdown-content {
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.message-content.markdown-content h1,
.message-content.markdown-content h2,
.message-content.markdown-content h3 {
    font-size: 1rem;
    line-height: 1.25;
    margin: 0.65em 0 0.35em;
}

.message-content.markdown-content ul {
    margin-bottom: 0.65em;
}

.message-content .markdown-code-block {
    margin: 0.7em 0;
    padding: 10px 12px;
    border-radius: 8px;
    max-width: 100%;
}

.message-content .markdown-table-wrapper {
    margin: 0.7em 0;
}

.article-editor {
    min-height: 360px;
    line-height: 1.6;
}

.article-full-header {
    margin-bottom: 20px;
}

.article-excerpt {
    font-size: 1rem;
    line-height: 1.45;
    color: var(--muted);
    padding: 12px 14px;
    background: var(--surface-muted);
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.article-excerpt p {
    margin: 0 0 0.45em;
}

.article-excerpt p:last-child {
    margin-bottom: 0;
}

.article-content {
    line-height: 1.75;
    font-size: 1.03rem;
    white-space: normal;
    margin-top: 24px;
}

.article-attachments {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.article-attachments h2,
.article-attachments h3 {
    margin: 0 0 12px;
}

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

.attachment-card-list a {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    text-decoration: none;
}

.attachment-card-list a:hover {
    border-color: #26323e;
    background: #ffffff;
    text-decoration: none;
}

.article-preview-summary {
    margin: 10px 0 14px;
}

.article-preview-summary p {
    margin: 0 0 0.65em;
}

.article-preview-summary p:last-child {
    margin-bottom: 0;
}

.article-preview-summary ul {
    margin: 0.4em 0 0.7em 1.2em;
}

.public-home-section {
    margin-bottom: 28px;
}

.public-home-grid {
    gap: 28px;
}

.public-home-grid .card,
.public-home-grid .post,
.public-home-grid .article-preview {
    margin-bottom: 18px;
}

/* Auteur / avatars dans les publications */

.post-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    overflow: hidden;
    flex: 0 0 auto;
}

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

.article-avatar,
.profile-avatar {
    width: 58px;
    height: 58px;
    font-size: 1.25rem;
}

/* ==========================================================
   Commentaires
   ========================================================== */

.comments-list {
    display: grid;
    gap: 12px;
    margin: 16px 0;
}

.comment {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
}

/* ==========================================================
   Chat
   ========================================================== */

.chat-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
    margin-top: 24px;
}

.chat-layout .card {
    margin-top: 0;
}

.message-type-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.message-type-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}

.message-type-nav a:hover,
.message-type-nav a.active {
    background: #26323e;
    border-color: #26323e;
    color: #ffffff;
    text-decoration: none;
}

.chat-sidebar {
    position: sticky;
    top: 82px;
    align-self: start;
}

.chat-panel {
    min-height: 360px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    border-bottom: 1px solid var(--border);
    margin: -4px -4px 14px;
    padding: 4px 4px 14px;
}

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

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid transparent;
}

.contact-item:hover,
.contact-item.active {
    background: var(--surface-muted);
    border-color: var(--border);
    text-decoration: none;
}

.contact-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: 0 0 auto;
}

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

.messages-list {
    height: 360px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.chat-message {
    max-width: 75%;
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border);
}

.chat-message.mine {
    align-self: flex-end;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.chat-message.other {
    align-self: flex-start;
}

.chat-message .message-author {
    font-weight: 800;
}

.message-author-row {
    margin-bottom: 6px;
}

.message-form {
    margin-top: 14px;
}

.message-form textarea {
    min-height: 80px;
}

.chat-empty-state,
.empty-state {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.empty-state {
    min-height: 420px;
}

/* ==========================================================
   Groupes
   ========================================================== */

.group-card h2 {
    margin-bottom: 6px;
}

.group-chat-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}

.group-chat-panel .messages-list {
    height: 420px;
}

.member-list {
    display: grid;
    gap: 10px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-muted);
}

.member-item form {
    margin: 0;
}

.member-item button {
    padding: 7px 10px;
    font-size: 0.9rem;
}

/* ==========================================================
   Messages
   ========================================================== */

.message-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.message-tools button {
    font-size: 0.78rem;
    padding: 5px 8px;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 650;
}

.message-tools button:hover {
    background: #eef2f7;
}

.message-tools button[data-delete-message] {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.message-tools button[data-delete-message]:hover {
    background: #fee2e2;
}

.message-tools button[data-edit-message] {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.message-tools button[data-edit-message]:hover {
    background: #dbeafe;
}

.message-attachment {
    margin-top: 8px;
    padding: 9px 10px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.message-attachment a {
    font-weight: 700;
    display: inline-block;
    margin-bottom: 4px;
}

.message-attachment .meta {
    display: block;
}

.message-attachment-header {
    display: grid;
    gap: 2px;
    margin-bottom: 8px;
}

.message-attachment-image {
    padding: 0;
    overflow: hidden;
    background: transparent;
}

.message-attachment-image a {
    display: block;
    margin: 0;
}

.message-attachment-image img {
    display: block;
    width: min(100%, 360px);
    max-height: 320px;
    object-fit: contain;
    border-radius: 10px;
    background: #ffffff;
}

.message-attachment-preview iframe {
    display: block;
    width: min(100%, 420px);
    height: 240px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.message-attachment-media audio,
.message-attachment-media video {
    display: block;
    width: min(100%, 420px);
}

.message-attachment-media video {
    max-height: 320px;
    border-radius: 8px;
    background: #101820;
}

.message-attachment-file {
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-file-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 900;
    flex: 0 0 auto;
}

.edited-marker {
    font-style: italic;
}

.message-search-result {
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    margin-bottom: 10px;
}

/* ==========================================================
   Admin
   ========================================================== */

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

.admin-actions form {
    margin: 0;
}

.admin-actions button {
    padding: 7px 10px;
    font-size: 0.9rem;
}

.admin-user-edit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
    gap: 22px;
    align-items: start;
}

/* ==========================================================
   Notifications
   ========================================================== */

.notification-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.notification-card.unread {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.notification-card h2 {
    font-size: 1rem;
    margin-bottom: 6px;
}

/* ==========================================================
   Profil
   ========================================================== */

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.profile-stats > div {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

.profile-stats .stat {
    display: block;
    font-size: 1.6rem;
}

/* ==========================================================
   Markdown
   ========================================================== */

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin-top: 1.4em;
    margin-bottom: 0.5em;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
    margin-top: 0;
}

.markdown-content p {
    margin: 0 0 1em;
}

.markdown-content ul {
    margin: 0 0 1em 1.4em;
    padding: 0;
}

.markdown-content li {
    margin-bottom: 0.35em;
}

.markdown-content code {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.92em;
}

.markdown-image {
    display: block;
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    border-radius: 8px;
    margin: 1em 0;
}

.markdown-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 1.2em 0;
}

.markdown-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
}

.markdown-table th,
.markdown-table td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    vertical-align: top;
}

.markdown-table th {
    background: var(--surface-muted);
    font-weight: 800;
}

.markdown-table td p,
.markdown-table th p {
    margin: 0;
}

.markdown-code-block {
    background: #0f172a;
    color: #f8fafc;
    border-radius: 12px;
    padding: 14px 16px;
    overflow-x: auto;
    line-height: 1.55;
    margin: 1.2em 0;
    border: 1px solid var(--border);
}

.markdown-code-block code {
    background: transparent;
    border: 0;
    color: inherit;
    padding: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    white-space: pre;
}

/* ==========================================================
   Barre Markdown
   ========================================================== */

.markdown-toolbar {
    position: sticky;
    top: 72px;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 10px;
    margin: 0 0 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-muted);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.markdown-toolbar button {
    width: auto;
    min-width: 38px;
    padding: 7px 10px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.markdown-toolbar button:hover {
    background: #eef2f7;
}

.toolbar-separator {
    width: 1px;
    height: 26px;
    background: var(--border);
    margin: 0 3px;
}

/* ==========================================================
   Pagination
   ========================================================== */

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 18px;
}

.pagination-current {
    cursor: default;
}

.pagination-ellipsis {
    color: var(--muted);
    padding: 8px 4px;
}

/* ==========================================================
   Footer
   ========================================================== */

.page-footer {
    margin-top: 40px;
    padding: 24px 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer-content p {
    margin: 0;
}

/* ==========================================================
   Auth
   ========================================================== */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.auth-container {
    width: min(520px, 100%);
}

.auth-return-link {
    margin: 14px 0 0;
    text-align: right;
}

/* ==========================================================
   Utilitaires
   ========================================================== */

.inline-form {
    margin: 0;
}

.inline-form select {
    min-width: 120px;
    padding: 7px 9px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 1100px) {
    .grid-4,
    .dashboard-grid.grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .site-header-inner {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 0;
    }

    .brand {
        max-width: none;
    }

    .main-nav {
        width: 100%;
    }

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

@media (max-width: 860px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        position: static;
    }

    .chat-message {
        max-width: 92%;
    }
}

@media (max-width: 760px) {
    .grid-2,
    .grid-3,
    .dashboard-latest-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-latest-grid > .card {
        min-height: 0;
    }

    .card {
        padding: 18px;
    }
}

/* ==========================================================
   Interface de gestion modernisée
   ========================================================== */

body:not(.auth-page):has(.site-header) {
    background:
        radial-gradient(circle at top left, rgba(15, 159, 140, 0.11), transparent 280px),
        linear-gradient(180deg, #eef3f7 0, #f6f7f3 320px, #f6f7f3 100%);
}

body:not(.auth-page) .page {
    padding-top: 32px;
}

body:not(.auth-page) main.page > .card:first-of-type:not(.article-full) {
    position: relative;
    overflow: hidden;
    min-height: 176px;
    display: grid;
    align-content: center;
    border: 1px solid rgba(22, 32, 42, 0.08);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 251, 251, 0.96) 54%, rgba(234, 243, 255, 0.9) 100%);
    box-shadow: 0 24px 70px rgba(22, 32, 42, 0.1);
}

body:not(.auth-page) main.page > .card:first-of-type:not(.article-full)::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: linear-gradient(180deg, var(--primary), var(--accent), var(--warm));
}

body:not(.auth-page) main.page > .card:first-of-type:not(.article-full)::after {
    content: "";
    position: absolute;
    right: 22px;
    top: 22px;
    width: 112px;
    height: 112px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.13), rgba(15, 159, 140, 0.13)),
        repeating-linear-gradient(45deg, rgba(16, 24, 32, 0.06) 0 1px, transparent 1px 10px);
    opacity: 0.75;
    border: 4px solid rgba(255, 255, 255, 0.86);
    box-shadow: 0 18px 42px rgba(22, 32, 42, 0.16);
}

body:not(.auth-page) main.page > .card:first-of-type:not(.article-full) > * {
    position: relative;
    z-index: 1;
}

body:not(.auth-page) main.page > .card:first-of-type:not(.article-full) h1 {
    max-width: 780px;
    margin-bottom: 10px;
    font-size: clamp(1.85rem, 3.5vw, 3rem);
}

body:not(.auth-page) main.page > .card:first-of-type:not(.article-full) p {
    max-width: 760px;
    font-size: 1.02rem;
}

body:not(.auth-page) main.page > .about-card:first-of-type:not(.article-full)::after {
    display: none;
}

body:not(.auth-page) main.page > .about-card:first-of-type:not(.article-full) h1 {
    margin-bottom: 28px;
}

.site-header {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 251, 0.9));
    box-shadow: 0 10px 35px rgba(22, 32, 42, 0.08);
}

.site-menu-toggle {
    background:
        linear-gradient(135deg, #ffffff 0%, #f8fbfb 100%);
}

.site-menu-toggle::before {
    content: "";
    width: 16px;
    height: 12px;
    background:
        linear-gradient(currentColor, currentColor) 0 0 / 16px 2px no-repeat,
        linear-gradient(currentColor, currentColor) 0 5px / 16px 2px no-repeat,
        linear-gradient(currentColor, currentColor) 0 10px / 16px 2px no-repeat;
    opacity: 0.76;
}

.site-menu-panel.main-nav {
    border-radius: 14px;
}

.nav-section {
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
}

.site-menu-panel.main-nav .nav-section-admin {
    background:
        linear-gradient(160deg, #101820 0%, #162838 100%);
}

.dashboard-grid.grid-4 > .dashboard-card,
.profile-stats > div {
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
}

.dashboard-grid.grid-4 > .dashboard-card {
    min-height: 170px;
    height: 170px;
    max-height: 170px;
}

.dashboard-grid .dashboard-card h2,
.profile-stats .muted {
    letter-spacing: 0;
}

.dashboard-grid .dashboard-card .stat,
.profile-stats .stat {
    color: #101820;
}

.dashboard-latest-grid > .card,
.chat-sidebar,
.chat-panel,
.group-chat-panel,
.public-stream-panel,
.table-wrapper,
main.page > section.card:not(:first-of-type) {
    box-shadow: 0 14px 36px rgba(22, 32, 42, 0.07);
}

main.page > section.card:not(:first-of-type) {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.feed-list .post,
.dashboard-latest-grid .post,
.article-list .article-preview,
.dashboard-latest-grid .article-preview,
.group-card,
.notification-card,
.message-search-result {
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.feed-list .post:hover,
.dashboard-latest-grid .post:hover,
.article-list .article-preview:hover,
.dashboard-latest-grid .article-preview:hover,
.group-card:hover,
.notification-card:hover,
.message-search-result:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 44px rgba(22, 32, 42, 0.1);
}

.post,
.article-preview,
.group-card,
.comment {
    border-color: rgba(22, 32, 42, 0.09);
}

.post::before {
    top: 16px;
    bottom: 16px;
}

.post-content,
.article-preview-summary,
.article-content {
    color: #26323e;
}

.table-wrapper {
    border-radius: 12px;
    border-color: rgba(22, 32, 42, 0.09);
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, #f8fbfb 0%, #eef3f7 100%);
    color: #43515e;
}

td {
    border-bottom-color: rgba(22, 32, 42, 0.08);
}

tbody tr {
    transition: background 0.12s ease;
}

tbody tr:hover td {
    background: #f8fbfb;
}

input,
textarea,
select {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

input[type="search"] {
    min-height: 46px;
    font-size: 1rem;
}

.admin-actions {
    align-items: center;
}

.admin-actions .button-secondary,
.admin-actions button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.86rem;
}

.admin-user-edit-grid {
    padding: 14px;
    border: 1px solid rgba(22, 32, 42, 0.08);
    border-radius: 12px;
    background: #f8fbfb;
}

.chat-layout,
.group-chat-layout {
    gap: 18px;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.messages-list {
    background:
        linear-gradient(180deg, #eef3f7 0%, #f8fbfb 100%);
}

.chat-message {
    border-color: rgba(22, 32, 42, 0.08);
}

.chat-message.mine {
    background:
        linear-gradient(180deg, #eaf3ff 0%, #f2f7ff 100%);
}

.contact-item {
    background: transparent;
}

.contact-item:hover,
.contact-item.active {
    background: #ffffff;
    box-shadow: var(--shadow-soft);
}

.markdown-toolbar {
    box-shadow: 0 12px 32px rgba(22, 32, 42, 0.1);
}

.button-primary,
button[type="submit"] {
    border: 1px solid rgba(37, 99, 235, 0.22);
}

.button-secondary,
.button {
    box-shadow: 0 6px 16px rgba(22, 32, 42, 0.04);
}

.badge {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.page-footer {
    background: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(10px);
}

@media (max-width: 760px) {
    body:not(.auth-page) main.page > .card:first-of-type:not(.article-full) {
        min-height: 0;
    }

    body:not(.auth-page) main.page > .card:first-of-type:not(.article-full)::after {
        display: none;
    }

    .dashboard-grid.grid-4 > .dashboard-card {
        height: auto;
        min-height: 150px;
        max-height: none;
    }
}

/* ==========================================================
   Accueil public façon réseau social
   ========================================================== */

.public-home {
    padding-bottom: 54px;
}

.public-hero {
    position: relative;
    min-height: min(760px, calc(100vh - 42px));
    display: flex;
    align-items: center;
    overflow: hidden;
    color: #26323e;
}

.public-hero-media {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.82) 34%, rgba(255, 255, 255, 0.28) 72%, rgba(255, 255, 255, 0.08) 100%),
        url("public-hero-schema-pastel.png") center / cover no-repeat;
}

.public-hero-content {
    position: relative;
    z-index: 1;
    width: min(1160px, calc(100% - 40px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: clamp(28px, 7vw, 90px);
    align-items: center;
    padding: 84px 0 96px;
}

.public-hero-copy {
    max-width: 720px;
}

.public-eyebrow {
    margin: 0 0 12px;
    color: #0f9f8c;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.public-hero .public-eyebrow {
    color: #126f64;
}

.public-hero h1 {
    color: #17212b;
    margin-bottom: 18px;
    font-size: clamp(2.5rem, 7vw, 5.7rem);
    max-width: 760px;
}

.public-hero-copy > p:not(.public-eyebrow) {
    max-width: 680px;
    margin: 0;
    color: #43515e;
    font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.public-hero .button-secondary {
    background: rgba(255, 255, 255, 0.72);
    color: #26323e;
    border-color: rgba(22, 32, 42, 0.16);
    backdrop-filter: blur(8px);
}

.public-hero-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--text);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px);
}

.public-composer,
.public-mini-post,
.public-mini-grid > div {
    border: 1px solid rgba(22, 32, 42, 0.1);
    border-radius: 10px;
    background: #ffffff;
}

.public-composer {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px;
}

.public-composer p,
.public-mini-post p {
    margin: 0;
}

.public-mini-post {
    padding: 14px;
}

.public-mini-post .badge {
    margin-bottom: 10px;
}

.public-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.public-mini-grid > div {
    display: grid;
    gap: 2px;
    padding: 12px;
    text-align: center;
}

.public-mini-grid strong {
    color: #101820;
    font-size: 1.45rem;
    line-height: 1;
}

.public-mini-grid span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.public-feature-band {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: -46px;
    position: relative;
    z-index: 2;
}

.public-feature-band article,
.public-stream-panel,
.public-cta {
    border: 1px solid rgba(22, 32, 42, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.public-feature-band article {
    padding: 22px;
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-bottom: 14px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: #087567;
    font-weight: 900;
}

.public-feature-band h2 {
    margin-bottom: 8px;
    font-size: 1.08rem;
}

.public-feature-band p {
    margin: 0;
    color: var(--muted);
}

.public-home-section {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin: 54px auto 18px;
}

.public-home-section h2 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.public-stream-panel {
    padding: 18px;
}

.public-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.public-section-heading h2 {
    margin: 0;
}

.tag-cloud-section {
    margin: 0 auto 28px;
    padding: 18px;
    border: 1px solid rgba(22, 32, 42, 0.09);
    background: #ffffff;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(22, 32, 42, 0.14);
    background: #f7f8fa;
    color: #26323e;
    text-decoration: none;
    font-weight: 800;
}

.tag-pill {
    min-height: 34px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: calc(0.86rem + (var(--tag-weight, 1) - 1) * 0.045rem);
}

.tag-pill span {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.82em;
}

.tag-pill:hover,
.tag-pill.active {
    background: #26323e;
    border-color: #26323e;
    color: #ffffff;
    text-decoration: none;
}

.tag-pill:hover span,
.tag-pill.active span {
    color: rgba(255, 255, 255, 0.78);
}

.public-stream-panel .feed-list,
.public-stream-panel .article-list {
    margin-top: 0;
}

.empty-public-card {
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed rgba(22, 32, 42, 0.16);
    border-radius: 10px;
    background: #f8fbfb;
}

.public-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 32px;
    padding: 28px;
    background:
        linear-gradient(135deg, #ffffff 0%, #f8fbfb 55%, #eaf3ff 100%);
}

.public-cta h2,
.public-cta p {
    margin: 0;
}

.public-cta h2 {
    margin-bottom: 8px;
}

.public-cta p {
    color: var(--muted);
}

@media (max-width: 920px) {
    .public-hero {
        min-height: auto;
    }

    .public-hero-content {
        grid-template-columns: 1fr;
        padding: 62px 0 82px;
    }

    .public-hero-card {
        max-width: 520px;
    }

    .public-feature-band {
        grid-template-columns: 1fr;
        margin-top: 18px;
    }
}

@media (max-width: 760px) {
    .public-hero-content {
        width: min(100% - 24px, 1160px);
        padding: 42px 0 58px;
    }

    .public-hero-card {
        display: none;
    }

    .public-home-section,
    .public-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    .public-mini-grid,
    .public-home-grid.grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .notification-card {
        flex-direction: column;
    }
}

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

    .dashboard-grid.grid-4 > .dashboard-card {
        height: auto;
        min-height: 180px;
        max-height: none;
    }

    .markdown-toolbar {
        position: static;
        gap: 5px;
    }

    .markdown-toolbar button {
        font-size: 0.82rem;
        padding: 6px 8px;
    }

    .toolbar-separator {
        display: none;
    }
}

/* ==========================================================
   Modernisation visuelle
   ========================================================== */

:root {
    --bg: #f6f7f3;
    --surface: #ffffff;
    --surface-muted: #f2f5f7;
    --surface-strong: #101820;
    --text: #16202a;
    --muted: #64727f;
    --border: #dfe5e8;
    --primary: #2563eb;
    --primary-dark: #1947a3;
    --accent: #0f9f8c;
    --accent-soft: #dff8f4;
    --warm: #f97316;
    --warm-soft: #fff1e7;
    --danger: #dc2626;
    --success: #15803d;
    --warning: #b45309;
    --info: #0369a1;
    --radius: 8px;
    --shadow: 0 18px 45px rgba(22, 32, 42, 0.08);
    --shadow-soft: 0 8px 20px rgba(22, 32, 42, 0.06);
    --focus: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

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

body {
    background:
        linear-gradient(180deg, #eef3f7 0, #f6f7f3 280px, #f6f7f3 100%);
    color: var(--text);
    font-size: 16px;
    line-height: 1.55;
}

a {
    color: #155bd4;
    font-weight: 650;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--primary-dark);
}

.container {
    width: min(1160px, calc(100% - 40px));
}

.page {
    padding: 34px 0 44px;
}

.card,
.post,
.article-preview,
.message,
.group-card,
.comment,
.member-item,
.message-search-result,
.profile-stats > div,
.table-wrapper {
    border-color: rgba(22, 32, 42, 0.1);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.card {
    padding: 26px;
}

.card:hover,
.post:hover,
.article-preview:hover,
.group-card:hover {
    border-color: rgba(15, 159, 140, 0.28);
}

h1,
h2,
h3 {
    color: #101820;
}

h1 {
    font-size: clamp(1.75rem, 3vw, 2.55rem);
    line-height: 1.05;
}

h2 {
    font-size: 1.28rem;
}

h3 {
    font-size: 1.08rem;
}

.muted,
.meta {
    color: var(--muted);
}

.meta {
    font-size: 0.88rem;
}

hr {
    border-top-color: rgba(22, 32, 42, 0.12);
}

.site-header {
    background: rgba(246, 247, 243, 0.88);
    border-bottom: 1px solid rgba(22, 32, 42, 0.1);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.site-header-inner {
    min-height: 72px;
}

.brand {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 240px;
    color: #101820;
    font-size: 1.05rem;
}

.brand::before {
    content: "";
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 8px;
    background:
        linear-gradient(135deg, var(--primary), var(--accent) 58%, var(--warm));
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.brand:hover {
    color: #101820;
    text-decoration: none;
}

.main-nav {
    justify-content: flex-end;
    gap: 4px;
}

.main-nav a {
    color: #26323e;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.9rem;
    font-weight: 700;
}

.main-nav a:hover {
    background: #ffffff;
    border-color: rgba(22, 32, 42, 0.1);
    box-shadow: var(--shadow-soft);
}

.main-nav a[href*="admin"] {
    background: #101820;
    color: #ffffff;
    border-color: #101820;
}

.main-nav a[href*="logout"] {
    background: var(--warm-soft);
    color: #9a3412;
    border-color: #fed7aa;
}

label {
    color: #26323e;
    font-size: 0.92rem;
}

input,
textarea,
select {
    border-color: rgba(22, 32, 42, 0.14);
    border-radius: 8px;
    background: #fbfcfc;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:hover,
textarea:hover,
select:hover {
    border-color: rgba(37, 99, 235, 0.36);
    background: #ffffff;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus);
    background: #ffffff;
}

textarea {
    line-height: 1.6;
}

.checkbox-label {
    background: var(--surface-muted);
    border: 1px solid rgba(22, 32, 42, 0.1);
    border-radius: 8px;
    padding: 10px 12px;
}

button,
.button,
.button-primary,
.button-secondary,
.button-danger {
    border-radius: 8px;
    padding: 10px 15px;
    min-height: 42px;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

button:hover,
.button:hover,
.button-primary:hover,
.button-secondary:hover,
.button-danger:hover {
    transform: translateY(-1px);
}

button:disabled,
.button[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.62;
    transform: none;
}

.button-primary,
button[type="submit"] {
    background: linear-gradient(135deg, var(--primary), #1d7fd8);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.button-primary:hover,
button[type="submit"]:hover {
    background: linear-gradient(135deg, var(--primary-dark), #155bd4);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.button-secondary,
.button {
    background: #ffffff;
    border-color: rgba(22, 32, 42, 0.12);
    color: #26323e;
}

.button-secondary:hover,
.button:hover {
    background: var(--surface-muted);
    border-color: rgba(15, 159, 140, 0.34);
}

.button-danger {
    background: #dc2626;
    box-shadow: 0 10px 20px rgba(220, 38, 38, 0.14);
}

button[data-publish-mastodon] {
    background: #eef7ff;
    color: #155bd4;
    border-color: #bfdbfe;
}

button[data-publish-mastodon]:hover {
    background: #dff8f4;
    border-color: rgba(15, 159, 140, 0.36);
    color: #087567;
}

.flash {
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.flash-success {
    background: #e9f9ef;
}

.flash-info {
    background: #eaf3ff;
}

.flash-warning {
    background: #fff6e8;
}

.flash-error {
    background: #fff0f0;
}

.dashboard-grid.grid-4 > .dashboard-card {
    position: relative;
    overflow: hidden;
    height: 190px;
    min-height: 190px;
    max-height: 190px;
    background:
        linear-gradient(180deg, #ffffff 0, #f8fbfb 100%);
}

.dashboard-grid.grid-4 > .dashboard-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--warm));
}

.dashboard-grid .dashboard-card h2 {
    color: var(--muted);
    font-size: 0.92rem;
    text-transform: uppercase;
}

.stat {
    color: #101820;
    font-size: 2.45rem;
}

.dashboard-latest-grid {
    gap: 22px;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
}

table {
    background: #ffffff;
}

th {
    background: #f0f4f6;
    color: #26323e;
    font-size: 0.82rem;
    text-transform: uppercase;
}

td {
    background: #ffffff;
}

tbody tr:hover td {
    background: #f8fbfb;
}

.badge {
    border-radius: 8px;
    padding: 5px 9px;
    background: #eef3f7;
    color: #26323e;
}

.badge-admin {
    background: #eaf3ff;
    color: #155bd4;
    border-color: #bfdbfe;
}

.badge-user,
.badge-active {
    background: var(--accent-soft);
    color: #087567;
    border-color: #9be7dc;
}

.badge-disabled {
    background: #fff0f0;
}

.feed-list,
.article-list,
.group-list,
.notifications-list {
    gap: 16px;
}

.post,
.article-preview,
.group-card {
    background: #ffffff;
    padding: 20px;
}

.post {
    position: relative;
}

.post::before {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--accent);
    opacity: 0.74;
}

.post-header,
.group-card-header {
    align-items: center;
}

.post-content {
    color: #26323e;
    font-size: 1.02rem;
}

.article-full {
    padding: clamp(22px, 4vw, 42px);
}

.article-full-header {
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(22, 32, 42, 0.1);
}

.article-excerpt {
    background: #f8fbfb;
    border-color: rgba(15, 159, 140, 0.24);
    color: #43515e;
}

.article-content {
    color: #26323e;
}

.post-avatar,
.contact-avatar {
    background: linear-gradient(135deg, #eaf3ff, var(--accent-soft));
    color: #155bd4;
}

.comment,
.member-item,
.message-search-result {
    background: #f8fbfb;
}

.chat-layout {
    gap: 22px;
}

.chat-sidebar,
.chat-panel {
    box-shadow: var(--shadow-soft);
}

.messages-list {
    height: 420px;
    background: #eef3f7;
    border-color: rgba(22, 32, 42, 0.1);
}

.chat-message {
    border-radius: 8px;
    box-shadow: 0 6px 14px rgba(22, 32, 42, 0.05);
}

.chat-message.mine {
    background: #eaf3ff;
    border-color: #bfdbfe;
}

.message-tools button {
    border-radius: 8px;
    min-height: 0;
}

.notification-card.unread {
    background: #eaf3ff;
    border-color: #bfdbfe;
}

.markdown-code-block {
    border-radius: 8px;
    background: #101820;
    border-color: #26323e;
}

.markdown-toolbar {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
}

.markdown-toolbar button {
    border-radius: 8px;
}

.page-footer {
    background: rgba(255, 255, 255, 0.78);
}

.auth-page {
    background:
        linear-gradient(135deg, #eef3f7 0, #f6f7f3 48%, #fff7ed 100%);
}

.auth-container .card {
    box-shadow: 0 28px 70px rgba(22, 32, 42, 0.14);
}

.auth-container .card h1 {
    margin-bottom: 8px;
}

@media (max-width: 900px) {
    .site-header-inner {
        gap: 10px;
    }

    .main-nav {
        justify-content: flex-start;
        padding-bottom: 2px;
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 24px, 1160px);
    }

    .page {
        padding-top: 22px;
    }

    .card,
    .post,
    .article-preview,
    .group-card {
        padding: 18px;
    }

    .form-actions {
        align-items: stretch;
    }

    .form-actions > a,
    .form-actions > button {
        flex: 1 1 auto;
    }
}

/* ==========================================================
   Menu principal compact
   ========================================================== */

.site-header-inner {
    position: relative;
}

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

.site-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid rgba(22, 32, 42, 0.12);
    border-radius: 8px;
    background: #ffffff;
    color: #26323e;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    user-select: none;
}

.site-menu-toggle::-webkit-details-marker {
    display: none;
}

.site-menu-toggle::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.16s ease;
}

.site-menu[open] .site-menu-toggle {
    border-color: rgba(15, 159, 140, 0.36);
    box-shadow: 0 14px 28px rgba(22, 32, 42, 0.12);
}

.site-menu[open] .site-menu-toggle::after {
    transform: rotate(225deg) translate(-2px, -1px);
}

.site-menu-panel.main-nav {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 60;
    width: min(760px, calc(100vw - 40px));
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    overflow: visible;
    white-space: normal;
    padding: 14px;
    border: 1px solid rgba(22, 32, 42, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 28px 70px rgba(22, 32, 42, 0.18);
    backdrop-filter: blur(16px);
}

.site-menu-panel-public.main-nav {
    width: min(260px, calc(100vw - 40px));
    grid-template-columns: 1fr;
}

.nav-section {
    display: grid;
    gap: 6px;
    align-content: start;
    padding: 10px;
    border-radius: 8px;
    background: #f8fbfb;
    border: 1px solid rgba(22, 32, 42, 0.08);
}

.nav-section-title {
    display: block;
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 850;
    text-transform: uppercase;
}

.site-menu-panel.main-nav a {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #26323e;
    font-size: 0.92rem;
    line-height: 1.2;
}

.site-menu-panel.main-nav a:hover {
    background: #ffffff;
    border-color: rgba(15, 159, 140, 0.26);
    box-shadow: var(--shadow-soft);
}

.site-menu-panel.main-nav a[aria-current="page"] {
    background: #eaf3ff;
    border-color: #bfdbfe;
    color: #155bd4;
}

.site-menu-panel.main-nav .nav-section-admin {
    background: #101820;
    border-color: #101820;
}

.site-menu-panel.main-nav .nav-section-admin .nav-section-title {
    color: rgba(255, 255, 255, 0.62);
}

.site-menu-panel.main-nav .nav-section-admin a {
    color: #ffffff;
}

.site-menu-panel.main-nav .nav-section-admin a:hover,
.site-menu-panel.main-nav .nav-section-admin a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.site-menu-panel.main-nav .nav-link-danger {
    background: var(--warm-soft);
    color: #9a3412;
    border-color: #fed7aa;
}

.site-menu-panel.main-nav .nav-link-danger:hover {
    background: #ffedd5;
}

@media (max-width: 900px) {
    .site-header-inner {
        align-items: center;
        flex-direction: row;
        padding: 10px 0;
    }
}

@media (max-width: 760px) {
    .site-menu {
        position: static;
    }

    .site-menu-panel.main-nav {
        left: 12px;
        right: 12px;
        width: auto;
        grid-template-columns: 1fr;
        max-height: calc(100vh - 98px);
        overflow-y: auto;
    }

    .brand {
        min-width: 0;
    }

    .site-menu-toggle {
        padding-inline: 12px;
    }

    .admin-user-edit-grid,
    .article-title-row,
    .profile-avatar-block {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: flex-start;
    }
}
