* {
    box-sizing: border-box;
}

:root {
    --bg: #f3efe7;
    --panel: #fffdfa;
    --panel-strong: #fff7ea;
    --ink: #1d232c;
    --muted: #61707d;
    --line: #d8d2c5;
    --brand: #c97817;
    --brand-dark: #864d0b;
    --brand-soft: #f5d8b0;
    --sidebar: #17212b;
    --sidebar-soft: #233140;
    --success-bg: #edf8ef;
    --success-line: #c9e7d0;
    --error-bg: #fff1f1;
    --error-line: #f2c8c8;
    --shadow: 0 20px 50px rgba(23, 33, 43, 0.08);
    --sidebar-w: 290px;
}

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

body {
    background:
        radial-gradient(circle at top left, rgba(201, 120, 23, 0.12), transparent 30%),
        linear-gradient(180deg, #f6f2eb 0%, #efe8dc 100%);
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

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

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

.admin-body {
    min-height: 100vh;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top right, rgba(245, 216, 176, 0.3), transparent 22%),
        linear-gradient(135deg, #14202b 0%, #263849 55%, #3e5365 100%);
}

.login-card {
    width: min(480px, 100%);
    background: rgba(255, 253, 250, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 28px;
    padding: 34px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.login-card h1,
.admin-topbar h1,
.panel h2,
.message-card h3 {
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand-dark);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    font-weight: 700;
}

.login-help {
    margin-top: 18px;
    color: var(--muted);
}

.login-footer-note {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(201, 120, 23, 0.08);
    color: var(--ink);
    font-size: 0.82rem;
}

.admin-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 24%),
        linear-gradient(180deg, var(--sidebar) 0%, #10171f 100%);
    color: #f7f7f5;
    padding: 24px 18px;
    position: relative;
    overflow-y: auto;
}

.sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.sidebar-head-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.sidebar-brand-wrap { min-width: 0; }

.sidebar-brand-logo {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 62px;
    object-fit: contain;
    margin-bottom: 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 5px;
}

.sidebar-kicker {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 6px;
    font-family: inherit;
}

.sidebar-toggle,
.sidebar-collapse-btn,
.menu-button {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-radius: 10px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.15s ease;
}
.sidebar-toggle,
.menu-button { display: none; }
.sidebar-collapse-btn { display: block; }
.sidebar-toggle:hover,
.sidebar-collapse-btn:hover,
.menu-button:hover { background: rgba(255,255,255,0.14); }

/* Bouton "Menu" visible dans la topbar claire */
.admin-topbar .menu-button {
    color: var(--ink);
    background: #fff;
    border-color: var(--line);
}

.admin-topbar .menu-button:hover {
    background: var(--panel-strong);
}

.sidebar-user {
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    display: grid;
    gap: 4px;
    margin-bottom: 20px;
}

.sidebar-user span {
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.92rem;
    word-break: break-word;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Nav group (category) ── */
.nav-group { border: none; }

.nav-group-label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.46);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-group-label::-webkit-details-marker { display: none; }
.nav-group-label::marker { display: none; }
.nav-group-label:hover { color: rgba(255,255,255,0.72); background: rgba(255,255,255,0.05); }
.nav-group[open] > .nav-group-label { color: rgba(255,255,255,0.62); }

.nav-group-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.88rem;
    flex-shrink: 0;
}

.nav-group-text { flex: 1; white-space: nowrap; overflow: hidden; }

.nav-group-arrow {
    margin-left: auto;
    font-size: 0.62rem;
    opacity: 0.45;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.nav-group[open] .nav-group-arrow { transform: rotate(180deg); }

.nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 8px;
    padding-bottom: 6px;
    margin-top: 2px;
}

/* ── Nav links inside groups ── */
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.78);
    transition: 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.is-active {
    color: #fff;
    background: linear-gradient(135deg, rgba(201, 120, 23, 0.28), rgba(255, 255, 255, 0.06));
    transform: translateX(2px);
}

.sidebar-nav a.is-locked {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

/* ── Collapsed sidebar ── */
.sidebar.is-collapsed .sidebar-collapse-btn::after { content: '››'; }
.sidebar.is-collapsed .sidebar-collapse-btn { font-size: 0; }
.sidebar.is-collapsed .sidebar-collapse-btn::after { font-size: 0.8rem; }

.sidebar.is-collapsed .sidebar-brand-wrap,
.sidebar.is-collapsed .sidebar-user,
.sidebar.is-collapsed .nav-group-text,
.sidebar.is-collapsed .nav-group-arrow,
.sidebar.is-collapsed .nav-group-items,
.sidebar.is-collapsed .nav-label-text { display: none !important; }

.sidebar.is-collapsed { padding: 16px 8px; overflow: visible; }

.sidebar.is-collapsed .sidebar-head {
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.sidebar.is-collapsed .sidebar-head-actions { flex-direction: column; align-items: center; }

.sidebar.is-collapsed .nav-group-label {
    justify-content: center;
    padding: 10px 6px;
}
.sidebar.is-collapsed .nav-group-icon { width: 34px; height: 34px; font-size: 1rem; }

.sidebar.is-collapsed .sidebar-footer { align-items: center; }
.sidebar.is-collapsed .sidebar-footer a { justify-content: center; }

.nav-lock {
    margin-left: auto;
    font-size: 0.72rem;
    opacity: 0.7;
}

.nav-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--brand-soft);
    font-size: 0.78rem;
    font-weight: 700;
}

.app-icon-svg {
    width: 22px;
    height: 22px;
    display: block;
    fill: currentColor;
}

.sidebar-footer {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 10px;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.72);
}

.sidebar-footer-note {
    margin-top: 6px;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    line-height: 1.35;
}

.nav-footer-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.admin-content {
    padding: 26px;
}

.admin-page-footer {
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid #dcc29c;
    border-radius: 10px;
    background: #fffaf1;
    color: #6b5d4c;
    font-size: 0.78rem;
    line-height: 1.4;
}

.admin-page-footer p {
    margin: 0;
}

.admin-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.admin-topbar h1 {
    margin: 0 0 6px;
    font-size: clamp(2rem, 3vw, 2.7rem);
}

.admin-topbar p {
    margin: 0;
    color: var(--muted);
    max-width: 760px;
}

.topbar-left {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.topbar-company-logo {
    width: auto;
    max-width: 140px;
    max-height: 56px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 4px 6px;
    flex-shrink: 0;
}

.topbar-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 46px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand) 0%, #e69a35 100%);
    color: #1c160e;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 22px rgba(201, 120, 23, 0.18);
}

.btn:hover {
    filter: brightness(1.03);
}

.btn-secondary,
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
}

.flash {
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.flash-success {
    background: var(--success-bg);
    border-color: var(--success-line);
}

.flash-error {
    background: var(--error-bg);
    border-color: var(--error-line);
}

.stats-grid,
.admin-grid {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.admin-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
}

.stat-card,
.panel,
.message-card,
.module-card {
    background: var(--panel);
    border: 1px solid rgba(216, 210, 197, 0.9);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 20px;
    display: grid;
    gap: 8px;
    transition: 0.2s ease;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--panel-strong);
    color: var(--brand-dark);
    font-size: 0.8rem;
    font-weight: 700;
}

.module-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--panel-strong);
    color: var(--brand-dark);
}

.stat-card strong {
    font-size: 2rem;
    line-height: 1;
}

.stat-card span {
    font-weight: 700;
}

.stat-card small {
    color: var(--muted);
}

.panel {
    padding: 22px;
    background: linear-gradient(180deg, #fffdfa 0%, #fff7ea 100%);
    border-top: 4px solid var(--brand);
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.settings-section {
    grid-column: 1 / -1;
    border: 1px dashed #d8c3a5;
    background: #fffaf1;
    border-radius: 14px;
    padding: 12px 14px;
}

.settings-section h3 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.settings-section p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.settings-panel {
    border-radius: 24px;
}

.settings-form {
    gap: 14px;
}

.settings-panel .settings-section {
    border: 1px solid #e2d5c4;
    border-left: 5px solid var(--brand);
    background: linear-gradient(180deg, #fffefb 0%, #fff8ed 100%);
    border-radius: 16px;
    padding: 14px 16px;
}

.settings-panel .form-grid {
    align-items: start;
}

.settings-panel .field textarea {
    min-height: 120px;
}

.logo-preview-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logo-preview-image {
    width: min(280px, 100%);
    max-height: 120px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px;
}

.logo-preview-empty {
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 12px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.7);
}

.panel-head h2 {
    margin: 0 0 6px;
    font-size: 1.35rem;
}

.panel-head p,
.inline-note {
    margin: 0;
    color: var(--muted);
}

.panel-meta {
    color: var(--muted);
    font-size: 0.94rem;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
}

.table th,
.table td {
    padding: 13px 12px;
    border-bottom: 0;
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    padding: 4px 12px 2px;
}

.table tbody tr {
    transition: background 0.15s;
    box-shadow: 0 8px 20px rgba(23, 33, 43, 0.08);
}

.table tbody td {
    background: #fff;
}

.table tbody td:first-child {
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.table tbody td:not(:first-child):not(:last-child) {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.table tbody td:last-child {
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
    border-right: 1px solid var(--line);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.table tbody tr:hover td {
    background: #fffbf4;
    border-color: #d7c4aa;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--panel-strong);
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 0.85rem;
}

.badge-green  { background: #e8f5e9; color: #1b5e20; }
.badge-blue   { background: #e3f2fd; color: #0d47a1; }
.badge-orange { background: #fff3e0; color: #bf360c; }
.badge-red    { background: #ffebee; color: #b71c1c; }
.badge-gray   { background: #f5f5f5; color: #616161; }

.module-browser {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.module-card {
    padding: 16px;
    display: grid;
    gap: 8px;
    transition: 0.2s ease;
}

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

.module-card span {
    color: var(--muted);
    font-size: 0.95rem;
}

.module-card .module-icon {
    color: var(--brand-dark);
    font-size: inherit;
}

.external-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.external-link-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fffaf1 100%);
    box-shadow: 0 10px 20px rgba(23, 33, 43, 0.08);
    padding: 14px;
    display: grid;
    gap: 8px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.external-link-card:hover {
    transform: translateY(-2px);
    border-color: #cfab7a;
}

.external-link-card strong {
    font-size: 1rem;
}

.external-link-card span {
    color: var(--muted);
    font-size: 0.9rem;
}

.external-links-grid.as-buttons {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.external-link-card.external-link-button {
    background: linear-gradient(180deg, #ffffff 0%, #fff6e8 100%);
    border: 1px solid #d6c2a2;
}

.external-link-card.external-link-button strong {
    color: #1d232c;
    font-size: 1.05rem;
}

.external-link-card.external-link-button span {
    color: #4e5c69;
}

.external-link-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.external-link-actions .btn {
    min-height: 40px;
    padding: 0 14px;
}

.external-embed-wrap {
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    min-height: 580px;
    background: #ffffff;
}

.external-embed-wrap iframe {
    width: 100%;
    min-height: 580px;
    border: 0;
    display: block;
}

.external-embed-stage {
    min-height: calc(100vh - 240px);
}

.external-embed-stage iframe {
    min-height: calc(100vh - 240px);
    background: #fff;
}

.admin-info-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}

.admin-info-card {
    background: linear-gradient(180deg, #ffffff 0%, #fffaf1 100%);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 20px rgba(23, 33, 43, 0.08);
    padding: 14px;
}

.admin-info-card.is-accent {
    border: 2px solid var(--planning-accent, var(--line));
    background: linear-gradient(180deg, var(--planning-accent-soft, #fffaf1) 0%, #ffffff 100%);
}

.admin-info-card-kv {
    display: grid;
    gap: 8px;
}

.admin-info-card-line {
    display: grid;
    gap: 2px;
}

.admin-info-card-line strong {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.roles-panel {
    border-radius: 24px;
}

.roles-permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.role-perm-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: linear-gradient(180deg, #fffdfa, #fff8ef);
    display: grid;
    gap: 8px;
}

.role-perm-card strong {
    font-size: 0.95rem;
}

.role-perm-switches {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.role-perm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    background: #fff;
    color: var(--ink);
    font-weight: 600;
}

.role-perm-toggle input[type="checkbox"] {
    width: auto;
    min-height: auto;
}

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

/* ── Color row (3 palettes côte à côte, pleine largeur) ── */
.field-color-row { display: flex; flex-direction: column; gap: 10px; }

.color-row-title {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--muted);
}

.color-row-items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.color-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
}

.color-item input[type="color"] {
    width: 100%;
    height: 72px;
    padding: 5px;
    border-radius: 14px;
    border: 2px solid var(--line);
    cursor: pointer;
    background: var(--panel);
    transition: border-color 0.15s ease, transform 0.12s ease;
}
.color-item input[type="color"]:hover {
    border-color: var(--brand);
    transform: scale(1.02);
}

.color-item > span {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    text-align: center;
}

.field {
    display: grid;
    gap: 8px;
}

.field.is-hidden {
    display: none;
}

.field > span:first-child {
    font-weight: 700;
}

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

.field-help,
.muted-inline {
    color: var(--muted);
    font-size: 0.88rem;
}

input,
textarea,
select {
    width: 100%;
    min-height: 50px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 12px 14px;
}

select.multiselect {
    min-height: 160px;
    border-radius: 12px;
    padding: 6px 4px;
}

select.multiselect option {
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
}

select.multiselect option:checked {
    background: var(--brand);
    color: #fff;
}

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

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid rgba(201, 120, 23, 0.18);
    border-color: var(--brand);
}

.checkbox-field {
    align-items: flex-start;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-line input {
    width: auto;
    min-height: 0;
    accent-color: var(--brand);
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

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

.actions a {
    color: #16578d;
    font-weight: 700;
}

.actions .danger-link {
    color: #a53030;
}

.message-list {
    display: grid;
    gap: 16px;
}

.message-card {
    padding: 20px;
}

.message-card.unread {
    border-left: 6px solid var(--brand);
}

.message-card.read {
    opacity: 0.92;
}

.message-top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.message-top h3 {
    margin: 0 0 6px;
    font-size: 1.28rem;
}

.message-top p,
.message-body,
.message-date {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.message-body {
    color: var(--ink);
    margin-bottom: 16px;
}

.inline-note {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--panel-strong);
}

.readonly-banner {
    padding: 10px 16px;
    border-radius: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 14px;
}

.readonly-fieldset {
    border: none;
    padding: 0;
    margin: 0;
    opacity: 0.55;
    pointer-events: none;
}

code {
    background: rgba(23, 33, 43, 0.06);
    padding: 2px 8px;
    border-radius: 999px;
}

.pagination {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    margin-top: 4px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
    transition: 0.15s;
}

.page-btn:hover {
    background: var(--panel-strong);
    border-color: var(--brand);
}

.page-btn.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.planning-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.planning-card {
    border: 1px solid var(--planning-accent, #d8c3a5);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--planning-accent-soft, #fffaf1) 0%, #ffffff 100%);
    padding: 14px;
    box-shadow: 0 10px 24px rgba(23, 33, 43, 0.1);
}

.planning-card.is-accent {
    border-width: 2px;
    box-shadow: 0 12px 24px rgba(23, 33, 43, 0.12);
}

.planning-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.planning-card-head h3 {
    margin: 0;
    font-size: 1rem;
}

.planning-card-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.planning-card-meta span {
    display: block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6d7c8a;
}

.planning-card-meta strong {
    font-size: .9rem;
}

.planning-card-note {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #d7dde3;
    font-size: .88rem;
    color: #394a58;
    line-height: 1.45;
    white-space: pre-wrap;
}

.planning-members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.member-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(201, 120, 23, 0.16);
    border: 1px solid #d8c3a5;
    font-size: .74rem;
    color: #1d232c;
    font-weight: 700;
    letter-spacing: 0.01em;
}

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

    .admin-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(320px, calc(100vw - 28px));
        z-index: 30;
        transform: translateX(-100%);
        transition: transform 0.24s ease;
    }

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

    .sidebar-toggle,
    .menu-button {
        display: inline-flex;
    }

    .sidebar-collapse-btn { display: none; }

    .admin-content {
        padding: 20px;
    }

    .admin-topbar {
        flex-direction: column;
    }

    .topbar-actions {
        justify-content: flex-start;
    }

    .module-browser,
    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .external-embed-wrap,
    .external-embed-wrap iframe {
        min-height: 420px;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .panel,
    .login-card {
        padding: 18px;
        border-radius: 20px;
    }

    .message-top,
    .panel-head {
        flex-direction: column;
    }

    .table th,
    .table td {
        padding: 12px 10px;
    }

    .table {
        border-spacing: 0 10px;
    }

    .admin-info-card-grid {
        grid-template-columns: 1fr;
    }
    .admin-page-footer {
        margin-top: 12px;
        font-size: 0.74rem;
    }
}

.is-disabled {
    opacity: .58;
}
