/* =========================================================
   MIVVI FULL STYLE.CSS REDESIGN
   Replaces accumulated Volume 1-42 CSS patches with a clean,
   accessible, theme-aware stylesheet.
   ========================================================= */

:root {
    --navy: #0d1726;
    --panel: #14243a;
    --panel-2: #1a304c;
    --cyan: #43d6e8;
    --amber: #f2b84b;
    --green: #36d28a;
    --blue: #3b82f6;
    --rose: #e05270;
    --violet: #8b6ff7;
    --orange: #cf5c10;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-soft: 0 16px 40px rgba(13, 23, 38, 0.12);
    --shadow-deep: 0 24px 60px rgba(13, 23, 38, 0.22);

    --font-main: Arial, Helvetica, sans-serif;
}

/* ---------- Theme variables ---------- */
body.theme-light,
body:not(.theme-dark) {
    --page: #eaf0f5;
    --app-bg: #0d1726;
    --sidebar-bg: #14243a;
    --sidebar-card: #1a304c;
    --surface: #ffffff;
    --surface-2: #f8fbfe;
    --surface-3: #eef4fa;
    --text: #111827;
    --text-soft: #334155;
    --muted: #66758a;
    --border: #d8e1ea;
    --border-strong: #b8cadb;
    --input-bg: #ffffff;
    --input-text: #111827;
    --button-bg: #0d1726;
    --button-text: #ffffff;
    --danger-bg: #c93f3f;
    --danger-text: #ffffff;
    --warning-bg: #fff7df;
    --warning-text: #7a4f00;
    --success-bg: #dcf6ec;
    --success-text: #146c4d;
}

body.theme-dark {
    --page: #061120;
    --app-bg: #061120;
    --sidebar-bg: #0a1728;
    --sidebar-card: #10233d;
    --surface: #0d1b2e;
    --surface-2: #12243c;
    --surface-3: #182d49;
    --text: #f6faff;
    --text-soft: #d9e6f6;
    --muted: #adc0d6;
    --border: #34506f;
    --border-strong: #4d6d94;
    --input-bg: #081525;
    --input-text: #ffffff;
    --button-bg: #173457;
    --button-text: #ffffff;
    --danger-bg: #dc2626;
    --danger-text: #ffffff;
    --warning-bg: #3d2f14;
    --warning-text: #ffe7a1;
    --success-bg: #12382b;
    --success-text: #a7f3d0;
}

/* ---------- Accent variables ---------- */
body.accent-cyan,
body:not(.accent-blue):not(.accent-green):not(.accent-amber):not(.accent-rose):not(.accent-violet) {
    --accent: #43d6e8;
    --accent-hover: #72e4f0;
    --on-accent: #061120;
    --accent-soft: rgba(67, 214, 232, 0.18);
}

body.accent-blue {
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --on-accent: #ffffff;
    --accent-soft: rgba(59, 130, 246, 0.18);
}

body.accent-green {
    --accent: #45d483;
    --accent-hover: #70e2a0;
    --on-accent: #071322;
    --accent-soft: rgba(69, 212, 131, 0.2);
}

body.accent-amber {
    --accent: #f2b84b;
    --accent-hover: #ffd06f;
    --on-accent: #171006;
    --accent-soft: rgba(242, 184, 75, 0.22);
}

body.accent-rose {
    --accent: #e05270;
    --accent-hover: #ef718c;
    --on-accent: #ffffff;
    --accent-soft: rgba(224, 82, 112, 0.2);
}

body.accent-violet {
    --accent: #8b6ff7;
    --accent-hover: #a693ff;
    --on-accent: #ffffff;
    --accent-soft: rgba(139, 111, 247, 0.2);
}

/* ---------- Reset / base ---------- */
* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--page);
    color: var(--text);
    font-family: var(--font-main);
    line-height: 1.45;
}

body.theme-dark {
    color-scheme: dark;
}

a {
    color: var(--accent);
    font-weight: 800;
    text-decoration-thickness: 2px;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    overflow-wrap: break-word;
}

/* ---------- Layout ---------- */
.app-shell {
    width: min(1280px, 96vw);
    min-height: 720px;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    overflow: hidden;
    border-radius: 22px;
    background: var(--app-bg);
    box-shadow: var(--shadow-deep);
}

.buddy-panel {
    min-width: 0;
    padding: 28px 24px;
    overflow-y: auto;
    background: var(--sidebar-bg);
    color: #eef7ff;
}

.main-panel {
    min-width: 0;
    margin: 18px 18px 18px 0;
    padding: 42px;
    overflow-x: hidden;
    border-radius: 18px;
    background: var(--surface-2);
    color: var(--text);
}

.settings-workspace-page,
.admin-console-workspace {
    width: 100%;
    color: var(--text);
}

/* ---------- Brand / sidebar ---------- */
.brand-block,
.profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark,
.large-mark,
.avatar,
.tiny-avatar,
.settings-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 900;
}

.brand-mark {
    width: 54px;
    height: 48px;
    border-radius: 18px;
    font-size: 25px;
}

.brand-block h1 {
    margin: 0;
    color: #ffffff;
    letter-spacing: 0.12em;
    font-size: 25px;
}

.brand-block p {
    margin: 4px 0 0;
    color: var(--accent);
    font-size: 11px;
    letter-spacing: 0.14em;
}

.profile-card {
    margin: 30px 0 14px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: var(--sidebar-card);
}

.avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
}

.tiny-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 13px;
}

.settings-avatar {
    width: 74px;
    height: 74px;
    margin-bottom: 14px;
    border-radius: 50%;
    font-size: 24px;
}

.profile-card strong,
.profile-card span,
.buddy-person span,
.buddy-person small {
    display: block;
}

.username-line,
.profile-status,
.buddy-person small,
.dm-list small,
.user-search-results small {
    color: #b7c6d8;
    font-size: 13px;
}

.presence {
    margin-top: 5px;
    font-size: 14px;
    font-weight: 800;
}

.presence-online,
.online {
    color: #45d483;
}

.presence-away,
.away {
    color: #f2b84b;
}

.presence-busy,
.busy {
    color: #ff8f8f;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.online { background: #45d483; }
.away { background: #f2b84b; }
.busy { background: #d83c3c; }
.offline { background: #cf5c10; }

.account-tier,
.private-badge,
.request-status,
.billing-pill,
.blocked-pill,
.notification-badge,
.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    border-radius: 999px;
    font-weight: 900;
}

.account-tier {
    margin-top: 7px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--accent);
    font-size: 11px;
    letter-spacing: 0.08em;
}

.panel-label {
    margin: 28px 0 14px;
    color: #9fb0c4;
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.logout-form { margin: 0 0 24px; }

.logout-form button,
.room-list a,
.dm-list a,
.empty-dm,
.notification-mini-card,
.create-room-form,
.upgrade-card,
.dm-search-form,
.user-search-results {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: #102238;
    color: #dde7f1;
}

.logout-form button {
    width: 100%;
    padding: 12px 14px;
}

.room-list,
.dm-list,
.buddy-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.room-list li,
.dm-list li {
    margin-bottom: 8px;
}

.room-list a,
.dm-list a {
    display: block;
    padding: 12px 14px;
    text-decoration: none;
}

.room-list a:hover,
.dm-list a:hover {
    background: #1d3655;
}

.room-list .active-room a,
.dm-list .active-dm a {
    background: var(--accent);
    color: var(--on-accent);
}

.buddy-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    color: #dde7f1;
}

.buddy-person {
    display: grid;
    gap: 3px;
}

.dm-thread-topline,
.user-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.unread-badge,
.notification-badge {
    min-width: 24px;
    min-height: 24px;
    padding: 0 8px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 12px;
}

.notification-badge {
    min-width: 32px;
    height: 32px;
}

.notification-badge.is-zero {
    background: rgba(255, 255, 255, 0.08);
    color: #9fb0c1;
}

.notification-mini-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 22px;
    padding: 14px 16px;
}

/* ---------- Forms / buttons ---------- */
button,
.button,
input[type="submit"] {
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--button-bg);
    color: var(--button-text);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

button:hover,
.button:hover,
input[type="submit"]:hover {
    filter: brightness(1.08);
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled,
.message-control:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.danger-button,
.deny-button,
.delete-message,
.report-actions .danger-button {
    background: var(--danger-bg) !important;
    color: var(--danger-text) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

input,
textarea,
select {
    width: 100%;
    max-width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--input-text);
    font: inherit;
    outline: none;
}

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

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 1;
}

select option {
    background: var(--surface);
    color: var(--text);
}

label {
    display: block;
    margin: 12px 0 7px;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 900;
}

form button,
.login-form button,
.auth-form button,
.profile-form button,
.appearance-form button,
.password-form button,
.recovery-settings-form button,
.dm-search-form button,
.create-room-form button,
.upgrade-card button,
.room-request-card button,
.access-request-actions button,
.maintenance-button,
.backup-primary-button {
    padding: 12px 15px;
}

.create-room-form,
.dm-search-form,
.upgrade-card {
    margin-top: 16px;
    padding: 16px;
}

.create-room-form input,
.dm-search-form input {
    background: #0f1f33;
    color: white;
    border-color: #29435f;
}

.private-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    color: #dde7f1;
    font-size: 13px;
    font-weight: 900;
}

.private-check input,
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    accent-color: var(--accent);
}

/* ---------- Authentication / start screen ---------- */
.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.main-panel > h2,
.chat-header h2,
.admin-console-hero h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(34px, 5vw, 56px);
    line-height: 1.05;
}

.lead {
    margin: 12px 0 28px;
    color: var(--muted);
    font-size: 18px;
}

.login-card,
.stop-card,
.auth-card,
.chat-card,
.auth-message-box {
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    color: var(--text);
}

.login-card {
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 42px;
}

.large-mark {
    width: 112px;
    height: 100px;
    border-radius: 18px;
    font-size: 54px;
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 22px;
}

.auth-card,
.stop-card {
    padding: 28px;
}

.auth-card h3,
.stop-card h3 {
    margin: 0 0 18px;
    font-size: 26px;
}

.auth-message-box {
    margin: 0 0 22px;
    padding: 16px 18px;
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text);
    font-weight: 800;
}

.auth-message-box p {
    margin: 0;
}

/* ---------- Chat ---------- */
.chat-card {
    min-height: 560px;
    display: grid;
    grid-template-rows: auto auto auto auto 1fr auto auto;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 30px 36px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    height: fit-content;
    padding: 10px 15px;
    border-radius: 999px;
    background: var(--success-bg);
    color: var(--success-text);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.room-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.message-list {
    min-height: 320px;
    padding: 28px 36px;
    overflow-y: auto;
    background: var(--surface-2);
}

.message {
    width: fit-content;
    max-width: 78%;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
}

.user-message {
    margin-left: auto;
    border-color: transparent;
    background: var(--accent);
    color: var(--on-accent);
}

.other-message,
.system-message {
    margin-right: auto;
}

.system-message {
    background: var(--surface-3);
    color: var(--text-soft);
}

.message strong,
.message-user-meta,
.message-time,
.edited-label {
    display: block;
}

.message strong {
    margin-bottom: 4px;
    font-size: 13px;
}

.message p,
.message-text {
    margin: 0;
    line-height: 1.42;
}

.message-user-meta,
.message-time,
.edited-label {
    color: currentColor;
    opacity: 0.78;
    font-size: 11px;
}

.message-time {
    margin-top: 6px;
}

.deleted-message {
    opacity: 0.75;
}

.deleted-message .message-text {
    font-style: italic;
}

.chat-form {
    display: grid;
    gap: 10px;
    padding: 20px 36px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.composer-main {
    display: flex;
    gap: 12px;
}

.composer-main input,
.chat-form input {
    flex: 1;
}

.chat-form button {
    margin: 0;
    padding: 14px 18px;
}

.attachment-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 9px 12px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.attachment-picker input {
    display: none;
}

.attachment-picker span {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-attachment {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.message-attachment img {
    display: block;
    width: min(320px, 100%);
    max-height: 260px;
    border-radius: 14px;
    object-fit: cover;
}

.message-attachment a,
.user-message .message-attachment a,
.other-message .message-attachment a,
.system-message .message-attachment a {
    color: currentColor;
    font-weight: 900;
    word-break: break-word;
}

.deleted-message .message-attachment,
.deleted-message .message-reactions {
    display: none;
}

.typing-indicator {
    min-height: 30px;
    padding: 7px 36px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    background: var(--surface-2);
    border-top: 1px solid rgba(216, 225, 234, 0.25);
}

.typing-indicator.typing-active::after {
    content: "";
    display: inline-block;
    width: 18px;
    overflow: hidden;
    vertical-align: bottom;
    animation: mivviTypingDots 1.2s steps(4, end) infinite;
}

@keyframes mivviTypingDots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75%, 100% { content: "..."; }
}

/* ---------- Message tools / reactions ---------- */
.message-controls,
.message-reactions,
.reaction-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.message-control,
.message-reaction {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--button-bg);
    color: var(--button-text);
    font-size: 12px;
    font-weight: 900;
}

.user-message .message-control,
.user-message .message-reaction {
    background: rgba(13, 23, 38, 0.9);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.message-control.report-message,
.report-message {
    background: var(--warning-bg) !important;
    color: var(--warning-text) !important;
    border-color: rgba(242, 184, 75, 0.5) !important;
}

.message-reaction {
    min-width: 46px;
    background: var(--surface-3);
    color: var(--text);
}

.message-reaction.reacted,
.user-message .message-reaction.reacted {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
}

.reaction-emoji { line-height: 1; }
.reaction-count { min-width: 8px; font-size: 12px; }

/* ---------- Search / pinned / mentions / exports ---------- */
.message-search-panel,
.pinned-panel,
.mention-help-card,
.conversation-export-panel {
    padding: 16px 36px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.pinned-panel {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.pinned-panel-header,
.message-search-result-top,
.pinned-item-top,
.notification-center-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.pinned-panel-header h3,
.pinned-panel-header span,
.message-search-form label {
    margin: 0;
}

.message-search-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
}

.message-search-results,
.pinned-list {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.message-search-result,
.pinned-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
}

.pinned-item {
    border-left: 5px solid var(--accent);
}

.pinned-empty,
.message-search-empty,
.notification-empty,
.file-manager-empty,
.maintenance-muted,
.request-note-muted {
    color: var(--muted);
}

.mention-token {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 900;
}

.mention-token-self,
.mentioned-me-message {
    box-shadow: 0 0 0 2px rgba(242, 184, 75, 0.55);
}

.jump-to-message,
.conversation-export-actions a,
.settings-back-link,
.admin-console-actions a,
.settings-launcher-actions a,
.admin-room-card header a,
.admin-upload-row a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--button-bg);
    color: var(--button-text) !important;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

/* ---------- Owner tools / room management ---------- */
.owner-tools {
    display: grid;
    gap: 14px;
    padding: 18px 36px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.owner-row,
.access-request-actions,
.report-actions,
.billing-actions,
.maintenance-actions,
.admin-console-actions,
.settings-launcher-actions,
.conversation-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.owner-row input {
    flex: 1 1 260px;
}

.member-box,
.role-box,
.access-request-box,
.recovery-card,
.billing-panel,
.tier-dev-box,
.safety-panel,
.notification-center-panel,
.room-request-panel,
.file-manager-panel,
.admin-tier-panel,
.admin-report-panel,
.admin-dashboard-panel,
.admin-room-panel,
.admin-upload-panel,
.admin-block-panel,
.admin-audit-panel,
.admin-maintenance-panel,
.admin-backup-restore-panel,
.admin-deployment-panel,
.admin-security-panel,
.admin-env-panel,
.admin-billing-panel,
.admin-console-hero,
.admin-console-launcher-panel,
.security-note-box,
.deployment-note-box,
.deployment-config-note,
.env-config-note,
.backup-restore-warning,
.billing-status-box {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
}

.member-row,
.role-row,
.access-request-row,
.sent-request-row,
.blocked-user-row,
.notification-card,
.room-request-card,
.file-manager-row,
.admin-room-card,
.admin-upload-row,
.admin-block-row,
.admin-user-row,
.report-card,
.audit-log-row,
.billing-history-row,
.billing-status-box,
.backup-latest-card,
.admin-billing-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
}

.member-row,
.role-row,
.blocked-user-row,
.admin-user-row,
.admin-upload-row,
.admin-block-row,
.file-manager-row,
.billing-history-row,
.sent-request-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.role-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
}

.role-list,
.room-request-list,
.notification-list,
.file-manager-list,
.admin-room-list,
.admin-upload-list,
.admin-block-list,
.admin-user-list,
.report-list,
.audit-log-list,
.billing-history-list,
.blocked-user-list,
.sent-request-history {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.private-badge,
.request-status,
.billing-pill {
    padding: 5px 9px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.private-badge,
.new-status,
.billing-pill {
    background: var(--accent-soft);
    color: var(--accent);
}

.pending-status,
.pending-billing {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.approved-status,
.active-billing,
.enabled,
.env-ready {
    background: var(--success-bg);
    color: var(--success-text);
}

.denied-status,
.env-missing {
    background: rgba(220, 38, 38, 0.15);
    color: #ffb4b4;
}

/* ---------- Settings workspace ---------- */
.account-settings {
    width: 100%;
    margin: 0 0 26px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.account-settings summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
    cursor: default;
}

.account-settings-inner.profile-settings-grid,
.account-settings-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    gap: 22px;
    align-items: start;
    padding: 24px;
    background: var(--surface-2);
}

.account-settings-inner > *,
.profile-form,
.appearance-form,
.password-form,
.recovery-settings-form,
.restore-backup-form {
    min-width: 0;
}

.notification-center-panel,
.room-request-panel,
.safety-panel,
.file-manager-panel,
.conversation-export-panel,
.admin-console-launcher-panel {
    grid-column: 1 / -1;
}

.profile-form h3,
.appearance-form h3,
.password-form h3,
.recovery-settings-form h3,
.account-settings h3,
.account-settings h4,
.account-settings h5 {
    margin-top: 0;
}

.appearance-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
}

.preview-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
}

.settings-launcher {
    margin-bottom: 24px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
}

/* ---------- Admin console ---------- */
.admin-console-workspace {
    display: grid;
    gap: 22px;
}

.admin-console-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.admin-console-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(340px, 1fr));
    gap: 22px;
}

.admin-dashboard-panel,
.admin-report-panel,
.admin-audit-panel,
.admin-maintenance-panel,
.admin-backup-restore-panel,
.admin-deployment-panel,
.admin-security-panel,
.admin-env-panel,
.admin-billing-panel {
    grid-column: 1 / -1;
}

.admin-stat-grid,
.maintenance-stat-grid,
.deployment-status-grid,
.security-config-grid,
.env-config-grid,
.backup-restore-grid,
.backup-action-grid,
.file-manager-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.admin-stat-grid article,
.maintenance-stat-grid article,
.deployment-status-grid article,
.security-config-grid article,
.env-config-grid article,
.backup-restore-grid > *,
.backup-action-grid > *,
.file-manager-stats article {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-2);
    color: var(--text);
}

.admin-stat-grid strong,
.maintenance-stat-grid strong,
.deployment-status-grid strong,
.backup-latest-card strong,
.admin-room-card dd {
    display: block;
    color: var(--text);
    font-size: 28px;
    font-weight: 900;
    line-height: 1.05;
}

.admin-stat-grid span,
.maintenance-stat-grid span,
.deployment-status-grid span {
    display: block;
    margin-top: 7px;
    color: var(--text-soft);
    font-weight: 900;
}

.admin-stat-grid small,
.maintenance-stat-grid small,
.deployment-status-grid small,
.admin-room-card small,
.admin-upload-row small,
.admin-block-row small,
.admin-user-row small,
.audit-log-row small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
}

.admin-room-card header,
.report-card header,
.audit-log-row,
.admin-upload-row,
.admin-block-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.admin-room-card header > div,
.admin-upload-row > div,
.admin-block-row > span,
.audit-log-main {
    min-width: 0;
    flex: 1 1 240px;
}

.admin-room-card dl,
.report-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.admin-room-card dl div,
.report-card dl div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.admin-room-card dt,
.report-card dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-room-card dd,
.report-card dd {
    margin: 6px 0 0;
}

.report-message {
    margin: 0 0 12px !important;
    padding: 12px;
    border-radius: 12px;
}

.report-open,
.unread-notification {
    border-color: var(--accent) !important;
}

.report-reviewed {
    border-color: rgba(52, 211, 153, 0.45) !important;
}

.report-dismissed {
    opacity: 0.78;
}

.admin-password-reset-form,
.restore-backup-form {
    display: grid;
    gap: 12px;
}

.maintenance-note,
.billing-note,
.warning-note,
.security-config-note,
.env-path-list,
.env-config-note,
.deployment-config-note,
.deployment-note-box {
    color: var(--muted);
}

/* ---------- Deployment / maintenance / backup specific ---------- */
.admin-deployment-panel,
.admin-maintenance-panel,
.admin-backup-restore-panel,
.admin-security-panel,
.admin-env-panel {
    border-left: 5px solid var(--accent);
}

.env-status-banner {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 800;
}

.env-path-list {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
}

.env-path-list code,
code {
    padding: 2px 5px;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--text);
    font-family: Consolas, Monaco, monospace;
}

/* ---------- Avatars ---------- */
.avatar-cyan { background: #43d6e8 !important; color: #061120 !important; }
.avatar-amber { background: #f2b84b !important; color: #171006 !important; }
.avatar-green { background: #36d28a !important; color: #061120 !important; }
.avatar-violet { background: #8b6ff7 !important; color: #ffffff !important; }
.avatar-rose { background: #e05270 !important; color: #ffffff !important; }
.avatar-slate { background: #64748b !important; color: #ffffff !important; }

/* ---------- Density ---------- */
body.density-compact .message {
    margin-bottom: 10px;
    padding: 10px 12px;
}

body.density-compact .message-list {
    padding-top: 18px;
    padding-bottom: 18px;
}

body.density-compact .chat-header,
body.density-compact .chat-form,
body.density-compact .message-search-panel,
body.density-compact .pinned-panel,
body.density-compact .mention-help-card,
body.density-compact .conversation-export-panel {
    padding-left: 28px;
    padding-right: 28px;
}

/* ---------- Dark theme hard guarantees ---------- */
body.theme-dark .surface,
body.theme-dark [class*="panel"],
body.theme-dark [class*="card"],
body.theme-dark [class*="box"],
body.theme-dark [class*="row"] {
    color: var(--text);
}

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3,
body.theme-dark h4,
body.theme-dark h5,
body.theme-dark h6,
body.theme-dark strong {
    color: var(--text);
}

body.theme-dark p,
body.theme-dark span,
body.theme-dark small,
body.theme-dark em,
body.theme-dark dt,
body.theme-dark dd,
body.theme-dark li,
body.theme-dark label,
body.theme-dark summary {
    color: var(--text-soft);
}

body.theme-dark .user-message,
body.theme-dark .user-message strong,
body.theme-dark .user-message span,
body.theme-dark .user-message p,
body.theme-dark .user-message small {
    color: var(--on-accent);
}

body.theme-dark .user-message .message-control,
body.theme-dark .user-message .message-reaction {
    color: #ffffff;
}

body.theme-dark input:-webkit-autofill,
body.theme-dark input:-webkit-autofill:hover,
body.theme-dark input:-webkit-autofill:focus,
body.theme-dark textarea:-webkit-autofill,
body.theme-dark select:-webkit-autofill {
    -webkit-text-fill-color: var(--input-text) !important;
    -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
    box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 1120px) {
    .app-shell {
        grid-template-columns: 280px minmax(0, 1fr);
    }

    .main-panel {
        padding: 30px;
    }

    .admin-console-grid,
    .account-settings-inner.profile-settings-grid,
    .account-settings-inner {
        grid-template-columns: 1fr;
    }

    .admin-room-panel,
    .admin-upload-panel,
    .admin-block-panel,
    .admin-tier-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    body {
        display: block;
        background: var(--app-bg);
    }

    .app-shell {
        width: 100%;
        min-height: 100vh;
        grid-template-columns: 1fr;
        border-radius: 0;
    }

    .buddy-panel {
        display: block;
        max-height: 44vh;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .main-panel {
        margin: 0;
        padding: 22px;
        border-radius: 0;
    }

    .login-card,
    .auth-grid,
    .admin-console-hero,
    .chat-header,
    .composer-main,
    .notification-center-header,
    .pinned-panel-header,
    .message-search-result-top,
    .report-actions,
    .owner-row,
    .member-row,
    .blocked-user-row,
    .admin-user-row,
    .admin-upload-row,
    .admin-block-row,
    .file-manager-row,
    .admin-room-card header {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-grid,
    .admin-stat-grid,
    .maintenance-stat-grid,
    .deployment-status-grid,
    .security-config-grid,
    .env-config-grid,
    .backup-restore-grid,
    .backup-action-grid,
    .file-manager-stats,
    .admin-room-card dl,
    .report-card dl,
    .message-search-row {
        grid-template-columns: 1fr;
    }

    .chat-header,
    .message-list,
    .chat-form,
    .message-search-panel,
    .pinned-panel,
    .mention-help-card,
    .conversation-export-panel,
    .typing-indicator,
    .owner-tools {
        padding-left: 20px;
        padding-right: 20px;
    }

    .message {
        max-width: 100%;
    }
}

@media (max-width: 540px) {
    .buddy-panel {
        max-height: 52vh;
        padding: 22px 18px;
    }

    .main-panel {
        padding: 16px;
    }

    .account-settings-inner,
    .account-settings-inner.profile-settings-grid {
        padding: 16px;
    }

    .main-panel > h2,
    .chat-header h2,
    .admin-console-hero h2 {
        font-size: 34px;
    }
}

/* =========================================================
   MIVVI Volume 43: Better Navigation System
   Clear Chat / Settings / Admin navigation for desktop + mobile
========================================================= */

.app-navigation {
    display: grid;
    gap: 10px;
    margin: 0 0 24px;
}

.nav-item {
    display: block;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: #102238;
    color: #dde7f1;
    text-decoration: none;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.nav-item:hover {
    background: #1d3655;
    border-color: rgba(67, 214, 232, 0.35);
    transform: translateY(-1px);
}

.nav-item span,
.nav-item small {
    display: block;
}

.nav-item span {
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.nav-item small {
    margin-top: 4px;
    color: #9fb0c4;
    font-size: 12px;
    line-height: 1.25;
}

.nav-item.active-nav {
    background: var(--cyan);
    color: var(--navy);
    border-color: var(--cyan);
}

.nav-item.active-nav small {
    color: rgba(13, 23, 38, 0.78);
}

.workspace-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 22px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.workspace-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 16px;
    border-radius: 13px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 900;
    line-height: 1.2;
}

.workspace-tab:hover {
    background: #eef4fa;
}

.workspace-tab.active-tab {
    background: var(--navy);
    color: white;
}

.settings-launcher,
.admin-console-launcher-panel {
    border-left: 5px solid var(--cyan);
}

body.theme-dark .workspace-nav {
    background: #0d1b2e !important;
    border-color: #35506f !important;
}

body.theme-dark .workspace-tab {
    color: #d8e5f5 !important;
}

body.theme-dark .workspace-tab:hover {
    background: #132743 !important;
    color: #ffffff !important;
}

body.theme-dark .workspace-tab.active-tab {
    background: var(--cyan) !important;
    color: #03111f !important;
}

body.theme-dark .nav-item {
    background: #102238 !important;
    color: #dde7f1 !important;
    border-color: #29435f !important;
}

body.theme-dark .nav-item small {
    color: #b8c7dc !important;
}

body.theme-dark .nav-item.active-nav {
    background: var(--cyan) !important;
    color: #03111f !important;
    border-color: var(--cyan) !important;
}

body.theme-dark .nav-item.active-nav small {
    color: rgba(3, 17, 31, 0.75) !important;
}

@media (max-width: 760px) {
    .workspace-nav {
        position: sticky;
        top: 0;
        z-index: 20;
        margin: -18px -18px 20px;
        padding: 10px 18px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .workspace-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* MIVVI Volume 44: Room Directory */
.room-directory-workspace {
    display: grid;
    gap: 22px;
}

.room-directory-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface, #ffffff);
    box-shadow: var(--shadow-soft, 0 12px 30px rgba(13, 23, 38, 0.08));
}

.room-directory-hero h2 {
    margin: 0;
    font-size: clamp(34px, 5vw, 54px);
}

.room-directory-hero .lead {
    margin-bottom: 0;
}

.room-directory-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.room-directory-actions a,
.room-directory-open,
.managed-room-columns a,
.requestable-room-card button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 14px;
    border: none;
    border-radius: 12px;
    background: var(--navy);
    color: #ffffff;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.room-directory-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.room-directory-stats article {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface, #ffffff);
}

.room-directory-stats strong {
    display: block;
    font-size: 32px;
    line-height: 1;
}

.room-directory-stats span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-weight: 900;
}

.room-directory-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.room-directory-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface, #ffffff);
}

.room-directory-wide {
    grid-column: 1 / -1;
}

.room-directory-panel h3 {
    margin: 0 0 8px;
    font-size: 24px;
}

.room-directory-panel > p {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.45;
}

.room-directory-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.compact-room-list {
    grid-template-columns: 1fr;
}

.room-directory-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-2, #f9fbfd);
}

.room-directory-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.room-directory-card strong,
.room-directory-card small {
    display: block;
}

.room-directory-card small {
    margin-top: 4px;
    color: var(--muted);
    line-height: 1.35;
}

.room-directory-card dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.room-directory-card dl div {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface, #ffffff);
}

.room-directory-card dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.room-directory-card dd {
    margin: 5px 0 0;
    font-size: 22px;
    font-weight: 900;
}

.requestable-room-card textarea {
    width: 100%;
    min-height: 78px;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    resize: vertical;
}

.requestable-room-card button {
    margin-top: 10px;
}

.managed-room-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.managed-room-columns h4 {
    margin: 0 0 10px;
}

.managed-room-columns a {
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 8px;
    background: var(--surface-2, #f4f7fa);
    color: var(--ink);
    border: 1px solid var(--line);
}

.room-directory-empty {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

body.theme-dark .room-directory-hero,
body.theme-dark .room-directory-stats article,
body.theme-dark .room-directory-panel,
body.theme-dark .room-directory-card dl div {
    background: var(--surface) !important;
    color: var(--ink) !important;
    border-color: var(--line) !important;
}

body.theme-dark .room-directory-card,
body.theme-dark .managed-room-columns a {
    background: var(--surface-2) !important;
    color: var(--ink) !important;
    border-color: var(--line) !important;
}

body.theme-dark .room-directory-actions a,
body.theme-dark .room-directory-open,
body.theme-dark .requestable-room-card button {
    background: var(--accent, var(--cyan)) !important;
    color: var(--accent-ink, #03111f) !important;
}

@media (max-width: 1000px) {
    .room-directory-stats,
    .room-directory-grid {
        grid-template-columns: 1fr;
    }

    .room-directory-hero {
        flex-direction: column;
    }

    .room-directory-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .room-directory-list,
    .managed-room-columns {
        grid-template-columns: 1fr;
    }

    .room-directory-card dl {
        grid-template-columns: 1fr;
    }
}

/* MIVVI Volume 45: Contact System */

.contacts-workspace {
    display: grid;
    gap: 22px;
}

.contacts-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--card);
    color: var(--text);
}

.contacts-hero h2 {
    margin: 0;
    font-size: clamp(34px, 4vw, 54px);
}

.contacts-hero .lead {
    margin-bottom: 0;
}

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

.contacts-actions a,
.contact-actions button,
.contact-request-actions button,
.contact-request-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--button-bg, var(--navy));
    color: var(--button-text, #ffffff);
    text-decoration: none;
    font-weight: 900;
    cursor: pointer;
}

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

.contacts-stats article {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
}

.contacts-stats strong {
    display: block;
    color: var(--heading);
    font-size: 32px;
    line-height: 1;
}

.contacts-stats span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-weight: 900;
}

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 18px;
    align-items: start;
}

.contacts-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--card);
    color: var(--text);
}

.contacts-panel-wide {
    grid-column: 1 / -1;
}

.contacts-panel h3 {
    margin: 0 0 8px;
    color: var(--heading);
    font-size: 22px;
}

.contacts-panel > p {
    margin: 0 0 16px;
    color: var(--muted);
    line-height: 1.45;
}

.contact-list,
.contact-request-list,
.sent-contact-list {
    display: grid;
    gap: 12px;
}

.contact-card,
.contact-request-card,
.sent-contact-row {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card-soft, var(--panel-soft));
    color: var(--text);
}

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

.contact-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.contact-profile strong,
.contact-profile small {
    display: block;
}

.contact-profile strong {
    color: var(--heading);
}

.contact-profile small,
.contacts-muted,
.contacts-empty,
.sent-contact-row small {
    color: var(--muted);
}

.contact-profile p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.35;
}

.contact-actions,
.contact-request-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.contact-request-form label {
    display: block;
    margin: 12px 0 7px;
    color: var(--heading);
    font-weight: 900;
}

.contact-request-form input,
.contact-request-form textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--input-bg, #ffffff);
    color: var(--input-text, var(--ink));
    font-family: inherit;
    font-size: 15px;
    outline: none;
}

.contact-request-form textarea {
    min-height: 92px;
    resize: vertical;
}

.contact-request-form input:focus,
.contact-request-form textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(67, 214, 232, 0.18);
}

.contact-request-card {
    display: grid;
    gap: 12px;
}

.contact-request-card p {
    margin: 0;
    color: var(--text);
    line-height: 1.45;
}

.sent-contact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sent-contact-row span,
.sent-contact-row small {
    display: block;
}

.sent-contact-row em {
    font-style: normal;
}

body.theme-dark .contacts-hero,
body.theme-dark .contacts-panel,
body.theme-dark .contacts-stats article,
body.theme-dark .contact-card,
body.theme-dark .contact-request-card,
body.theme-dark .sent-contact-row {
    background: var(--card) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

body.theme-dark .contact-card,
body.theme-dark .contact-request-card,
body.theme-dark .sent-contact-row {
    background: var(--card-soft) !important;
}

body.theme-dark .contact-request-form input,
body.theme-dark .contact-request-form textarea {
    background: var(--input-bg) !important;
    color: var(--input-text) !important;
    border-color: var(--line) !important;
}

@media (max-width: 900px) {
    .contacts-hero,
    .contact-card,
    .sent-contact-row {
        flex-direction: column;
        align-items: stretch;
    }

    .contacts-stats,
    .contacts-grid {
        grid-template-columns: 1fr;
    }

    .contacts-actions,
    .contact-actions,
    .contact-request-actions,
    .contact-actions form,
    .contact-request-actions form,
    .contact-actions button,
    .contact-request-actions button {
        width: 100%;
    }
}

/* =========================================================
   MIVVI Volume 46: User Profile Pages
========================================================= */

.sidebar-profile-link {
    display: inline-flex;
    width: fit-content;
    margin-top: 8px;
    color: var(--accent, #43d6e8);
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.sidebar-profile-link:hover,
.profile-inline-link:hover,
.buddy-profile-link:hover {
    text-decoration: underline;
}

.profile-inline-link,
.buddy-profile-link {
    color: inherit;
    font-weight: 900;
    text-decoration: none;
}

.search-result-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.mini-link-button,
.profile-action-link,
.profile-hero-actions a,
.profile-shared-room-list a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md, 14px);
    font-weight: 900;
    text-decoration: none;
}

.mini-link-button {
    padding: 8px 10px;
    border: 1px solid var(--border, #d8e1ea);
    background: var(--surface-3, #eef4fa);
    color: var(--text, #111827);
    font-size: 12px;
}

.profile-workspace {
    display: grid;
    gap: 20px;
}

.profile-hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 26px;
    border: 1px solid var(--border, #d8e1ea);
    border-radius: var(--radius-xl, 24px);
    background: var(--surface, #ffffff);
    box-shadow: var(--shadow-soft, 0 16px 40px rgba(13, 23, 38, 0.12));
}

.profile-hero-main {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.profile-avatar-large {
    width: 92px;
    height: 92px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 28px;
    font-size: 30px;
    font-weight: 950;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.profile-hero-card h2 {
    margin: 0;
    font-size: clamp(34px, 5vw, 54px);
    line-height: 1;
}

.profile-hero-card .lead {
    margin-bottom: 0;
}

.profile-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-hero-actions a,
.profile-action-link {
    padding: 12px 15px;
    border: 1px solid var(--border-strong, #b8cadb);
    background: var(--button-bg, #0d1726);
    color: var(--button-text, #ffffff);
}

.profile-badge-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.presence-chip,
.profile-status-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 8px 10px;
    border-radius: 999px;
    background: var(--surface-3, #eef4fa);
    color: var(--text-soft, #334155);
    font-size: 12px;
    font-weight: 900;
}

.presence-chip.presence-online {
    background: var(--success-bg, #dcf6ec);
    color: var(--success-text, #146c4d);
}

.presence-chip.presence-away {
    background: var(--warning-bg, #fff7df);
    color: var(--warning-text, #7a4f00);
}

.presence-chip.presence-busy {
    background: rgba(220, 38, 38, 0.16);
    color: #ffb4b4;
}

.success-chip {
    background: var(--success-bg, #dcf6ec);
    color: var(--success-text, #146c4d);
}

.warning-chip {
    background: var(--warning-bg, #fff7df);
    color: var(--warning-text, #7a4f00);
}

.danger-chip {
    background: rgba(220, 38, 38, 0.16);
    color: #ffb4b4;
}

.profile-page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 18px;
}

.profile-page-panel {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--border, #d8e1ea);
    border-radius: var(--radius-lg, 18px);
    background: var(--surface, #ffffff);
    color: var(--text, #111827);
}

.profile-page-panel-wide {
    grid-column: 1 / -1;
}

.profile-page-panel h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

.profile-page-panel p {
    color: var(--text-soft, #334155);
    line-height: 1.5;
}

.profile-status-message {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 800;
}

.muted-text {
    color: var(--muted, #66758a) !important;
}

.profile-details-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.profile-details-list div {
    padding: 14px;
    border: 1px solid var(--border, #d8e1ea);
    border-radius: var(--radius-md, 14px);
    background: var(--surface-2, #f8fbfe);
}

.profile-details-list dt {
    color: var(--muted, #66758a);
    font-size: 12px;
    font-weight: 900;
}

.profile-details-list dd {
    margin: 6px 0 0;
    color: var(--text, #111827);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.profile-page-panel form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.profile-page-panel button {
    width: fit-content;
}

.profile-action-note {
    margin: 14px 0 0;
    font-weight: 800;
}

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

.profile-contact-form label {
    color: var(--text, #111827);
    font-weight: 900;
}

.profile-contact-form textarea {
    min-height: 90px;
    resize: vertical;
}

.profile-shared-room-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.profile-shared-room-list a {
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border, #d8e1ea);
    background: var(--surface-2, #f8fbfe);
    color: var(--text, #111827);
}

.profile-shared-room-list a:hover {
    border-color: var(--accent, #43d6e8);
    background: var(--accent-soft, rgba(67, 214, 232, 0.18));
}

.profile-shared-room-list span,
.profile-shared-room-list small {
    display: block;
}

.profile-shared-room-list small {
    color: var(--muted, #66758a);
    font-weight: 800;
}

body.theme-dark .mini-link-button {
    background: var(--surface-3, #182d49);
    color: var(--text, #f6faff);
}

body.theme-dark .profile-page-panel,
body.theme-dark .profile-hero-card,
body.theme-dark .profile-details-list div,
body.theme-dark .profile-shared-room-list a {
    border-color: var(--border, #34506f);
}

body.theme-dark .danger-chip,
body.theme-dark .presence-chip.presence-busy {
    background: rgba(220, 38, 38, 0.24);
    color: #ffd7d7;
}

@media (max-width: 900px) {
    .profile-hero-card,
    .profile-hero-main {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-page-grid,
    .profile-details-list {
        grid-template-columns: 1fr;
    }

    .profile-page-panel button,
    .profile-action-link,
    .profile-hero-actions,
    .profile-hero-actions a,
    .profile-action-row,
    .profile-action-row form,
    .profile-action-row button {
        width: 100%;
    }

    .search-result-actions {
        justify-content: flex-start;
    }
}

/* =========================================================
   MIVVI Volume 47: Better Notification Routing
========================================================= */

.notification-mini-link {
    text-decoration: none;
}

.notification-mini-link:hover {
    transform: translateY(-1px);
}

.notifications-workspace {
    display: grid;
    gap: 22px;
}

.notifications-hero,
.notification-routing-toolbar,
.notification-routing-card,
.notification-routing-empty {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(13, 23, 38, 0.08);
}

.notifications-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    padding: 30px;
}

.notifications-hero h2 {
    margin: 0;
    font-size: clamp(36px, 5vw, 56px);
}

.notifications-hero .lead {
    margin-bottom: 0;
}

.notifications-hero-actions,
.notification-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.notifications-hero-actions a,
.notification-bulk-actions button,
.notification-routing-card button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--navy);
    color: #ffffff;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.notifications-hero-actions a:hover,
.notification-bulk-actions button:hover,
.notification-routing-card button:hover {
    filter: brightness(1.08);
}

.notification-routing-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.notification-routing-summary article {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #f9fbfd;
}

.notification-routing-summary strong {
    display: block;
    font-size: 34px;
    line-height: 1;
}

.notification-routing-summary span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-weight: 900;
}

.notification-routing-toolbar {
    display: grid;
    gap: 16px;
    padding: 18px;
}

.notification-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.notification-filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f4f7fa;
    color: var(--ink);
    font-weight: 900;
    text-decoration: none;
}

.notification-filter-tab small {
    min-width: 25px;
    height: 25px;
    display: inline-grid;
    place-items: center;
    padding: 0 7px;
    border-radius: 999px;
    background: #ffffff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.notification-filter-tab.active-filter {
    background: var(--cyan);
    color: var(--navy);
    border-color: transparent;
}

.notification-filter-tab.active-filter small {
    background: var(--navy);
    color: var(--cyan);
}

.notification-routing-list {
    display: grid;
    gap: 14px;
}

.notification-routing-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 18px;
}

.notification-routing-card.unread-notification {
    border-color: var(--amber);
    background: #fff9ea;
}

.notification-routing-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.notification-routing-meta span,
.notification-routing-meta strong {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.notification-routing-meta span {
    background: #eaf0f5;
    color: var(--ink);
}

.notification-routing-meta strong {
    background: #dcf6ec;
    color: #167452;
}

.notification-routing-card.unread-notification .notification-routing-meta strong {
    background: #fff2c7;
    color: #7a4f00;
}

.notification-routing-card h3 {
    margin: 0 0 8px;
    font-size: 19px;
}

.notification-routing-card p {
    margin: 0 0 8px;
    color: var(--muted);
    line-height: 1.45;
    font-weight: 700;
}

.notification-routing-card small {
    color: var(--muted);
    font-weight: 800;
}

.notification-routing-empty {
    padding: 34px;
    text-align: center;
}

.notification-routing-empty h3 {
    margin: 0 0 8px;
    font-size: 24px;
}

.notification-routing-empty p {
    margin: 0 auto;
    max-width: 640px;
    color: var(--muted);
    line-height: 1.5;
    font-weight: 700;
}

body.theme-dark .notifications-hero,
body.theme-dark .notification-routing-toolbar,
body.theme-dark .notification-routing-card,
body.theme-dark .notification-routing-empty {
    background: #0d1b2e !important;
    color: #f4f8ff !important;
    border-color: #35506f !important;
    box-shadow: none;
}

body.theme-dark .notification-routing-summary article,
body.theme-dark .notification-filter-tab {
    background: #101f35 !important;
    color: #f4f8ff !important;
    border-color: #35506f !important;
}

body.theme-dark .notification-filter-tab small,
body.theme-dark .notification-routing-meta span {
    background: #132743 !important;
    color: #d8e5f5 !important;
}

body.theme-dark .notification-filter-tab.active-filter {
    background: var(--cyan) !important;
    color: #03111f !important;
}

body.theme-dark .notification-filter-tab.active-filter small {
    background: #03111f !important;
    color: #ffffff !important;
}

body.theme-dark .notification-routing-card.unread-notification {
    background: #152a3f !important;
    border-color: var(--amber) !important;
}

body.theme-dark .notification-routing-card h3,
body.theme-dark .notifications-hero h2,
body.theme-dark .notification-routing-summary strong,
body.theme-dark .notification-routing-empty h3 {
    color: #ffffff !important;
}

body.theme-dark .notification-routing-card p,
body.theme-dark .notification-routing-card small,
body.theme-dark .notification-routing-summary span,
body.theme-dark .notification-routing-empty p {
    color: #d8e5f5 !important;
}

body.theme-dark .notification-routing-meta strong {
    background: #174733 !important;
    color: #aef4d3 !important;
}

body.theme-dark .notification-routing-card.unread-notification .notification-routing-meta strong {
    background: #4a3512 !important;
    color: #ffe1a0 !important;
}

body.theme-dark .notifications-hero-actions a,
body.theme-dark .notification-bulk-actions button,
body.theme-dark .notification-routing-card button {
    background: var(--cyan) !important;
    color: #03111f !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
}

@media (max-width: 760px) {
    .notifications-hero,
    .notification-routing-card {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .notification-routing-summary {
        grid-template-columns: 1fr;
    }

    .notifications-hero-actions,
    .notification-bulk-actions,
    .notification-routing-card form,
    .notification-routing-card button {
        width: 100%;
    }
}

/* =========================================================
   MIVVI Volume 48 — Message Thread Replies
   Adds reply previews inside messages and a reply composer bar.
========================================================= */

.reply-composer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--cyan);
    border-radius: 16px;
    background: rgba(67, 214, 232, 0.12);
}

.reply-composer[hidden] {
    display: none !important;
}

.reply-composer div {
    min-width: 0;
}

.reply-composer strong {
    display: block;
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
}

.reply-composer p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-composer button {
    flex: 0 0 auto;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: var(--navy);
    color: white;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.message-reply-preview {
    display: grid;
    gap: 3px;
    width: 100%;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid rgba(13, 23, 38, 0.12);
    border-left: 4px solid var(--cyan);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.message-reply-preview strong {
    margin: 0;
    color: inherit;
    font-size: 12px;
    font-weight: 900;
}

.message-reply-preview span {
    display: block;
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    opacity: 0.82;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-message .message-reply-preview {
    border-color: rgba(255, 255, 255, 0.22);
    border-left-color: var(--cyan);
    background: rgba(255, 255, 255, 0.14);
    color: white;
}

.message-reply-preview:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.reply-message {
    border-color: rgba(67, 214, 232, 0.45) !important;
}

.reply-jump-highlight {
    animation: replyJumpPulse 1.4s ease;
    outline: 2px solid rgba(67, 214, 232, 0.72);
    outline-offset: 3px;
}

@keyframes replyJumpPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(67, 214, 232, 0.75);
    }

    100% {
        box-shadow: 0 0 0 16px rgba(67, 214, 232, 0);
    }
}

body.theme-dark .reply-composer {
    background: rgba(67, 214, 232, 0.12);
    border-color: #35506f;
    border-left-color: var(--cyan);
}

body.theme-dark .reply-composer strong {
    color: #ffffff;
}

body.theme-dark .reply-composer p {
    color: #b8c7dc;
}

body.theme-dark .reply-composer button {
    background: #173457 !important;
    color: #ffffff !important;
    border: 1px solid #4d6d94 !important;
}

body.theme-dark .message-reply-preview {
    background: rgba(7, 19, 34, 0.68);
    border-color: rgba(255, 255, 255, 0.14);
    border-left-color: var(--cyan);
    color: #f4f8ff;
}

body.theme-dark .other-message .message-reply-preview {
    background: rgba(13, 27, 46, 0.78);
}

@media (max-width: 760px) {
    .reply-composer {
        align-items: stretch;
        flex-direction: column;
    }

    .reply-composer button {
        width: 100%;
    }
}

/* =========================================================
   MIVVI Volume 50 — Invite Links
   ========================================================= */

.invite-links-workspace {
    display: grid;
    gap: 22px;
}

.invite-links-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.invite-links-hero .lead {
    max-width: 720px;
    margin-bottom: 0;
}

.invite-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.invite-stats-grid article {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.invite-stats-grid strong {
    display: block;
    color: var(--text);
    font-size: 30px;
    line-height: 1;
    font-weight: 900;
}

.invite-stats-grid span {
    display: block;
    margin-top: 8px;
    color: var(--text-soft);
    font-weight: 800;
}

.invite-links-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.4fr);
    gap: 20px;
    align-items: start;
}

.invite-links-panel {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

.invite-links-panel h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 22px;
    font-weight: 900;
}

.invite-links-panel p {
    margin: 0 0 16px;
    color: var(--text-soft);
    line-height: 1.45;
}

.invite-create-form {
    display: grid;
    gap: 12px;
}

.invite-create-form label {
    color: var(--text);
    font-weight: 900;
    font-size: 14px;
}

.invite-create-form input,
.invite-create-form select,
.invite-url-box input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    color: var(--input-text);
    font-size: 15px;
    outline: none;
}

.invite-create-form input:focus,
.invite-create-form select:focus,
.invite-url-box input:focus {
    border-color: var(--accent);
    outline: 2px solid var(--accent-soft);
}

.invite-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.invite-create-form button,
.invite-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 160px;
    margin-top: 8px;
    padding: 13px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--on-accent) !important;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.invite-link-list {
    display: grid;
    gap: 14px;
}

.invite-link-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
}

.invite-link-card.invite-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
}

.invite-link-card.invite-inactive {
    opacity: 0.88;
}

.invite-link-card header,
.invite-link-card footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.invite-link-card strong,
.invite-link-card small {
    display: block;
}

.invite-link-card strong {
    color: var(--text);
    font-size: 17px;
    font-weight: 900;
}

.invite-link-card small {
    margin-top: 5px;
    color: var(--muted);
    line-height: 1.35;
}

.invite-status-pill {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
    font-size: 12px;
    font-weight: 900;
}

.invite-note {
    margin: 0 !important;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--surface-3);
    color: var(--text-soft) !important;
    font-weight: 700;
}

.invite-url-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.invite-url-box a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--button-bg);
    color: var(--button-text) !important;
    font-weight: 900;
    text-decoration: none;
}

.invite-link-card footer form {
    flex: 0 0 auto;
}

.invite-link-card footer button {
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-3);
    color: var(--text);
    font-weight: 900;
    cursor: pointer;
}

.invite-link-card footer button:hover {
    border-color: var(--danger-bg);
    color: var(--danger-bg);
}

.invite-empty {
    margin: 0;
    color: var(--muted) !important;
    font-weight: 800;
}

@media (max-width: 1050px) {
    .invite-stats-grid,
    .invite-links-grid {
        grid-template-columns: 1fr 1fr;
    }

    .invite-links-wide {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .invite-links-hero,
    .invite-link-card header,
    .invite-link-card footer {
        flex-direction: column;
    }

    .invite-stats-grid,
    .invite-links-grid,
    .invite-form-row,
    .invite-url-box {
        grid-template-columns: 1fr;
    }

    .invite-create-form button,
    .invite-link-button,
    .invite-url-box a,
    .invite-link-card footer button {
        width: 100%;
    }
}

/* =========================================================
   MIVVI Volume 54: Data Retention Settings
========================================================= */

.admin-retention-panel {
    grid-column: 1 / -1;
    padding: 22px;
    border: 1px solid var(--line, #d8e1ea);
    border-radius: 18px;
    background: var(--card, #ffffff);
}

.admin-retention-panel h3 {
    margin: 0 0 8px;
}

.admin-retention-panel p {
    margin: 0 0 16px;
    color: var(--muted, #5e6b7c);
    line-height: 1.45;
}

.retention-summary-grid,
.retention-preview-box dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.retention-summary-grid article,
.retention-preview-box dl div {
    padding: 16px;
    border: 1px solid var(--line, #d8e1ea);
    border-radius: 16px;
    background: var(--surface, #f9fbfd);
}

.retention-summary-grid strong,
.retention-preview-box dd {
    display: block;
    margin: 0;
    font-size: 28px;
    line-height: 1;
    font-weight: 900;
}

.retention-summary-grid span,
.retention-preview-box dt {
    display: block;
    margin-top: 8px;
    font-weight: 900;
}

.retention-summary-grid small {
    display: block;
    margin-top: 6px;
    color: var(--muted, #5e6b7c);
    line-height: 1.35;
}

.retention-settings-form {
    margin-top: 18px;
}

.retention-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.retention-form-grid label {
    display: grid;
    gap: 7px;
    padding: 14px;
    border: 1px solid var(--line, #d8e1ea);
    border-radius: 16px;
    background: var(--surface, #f9fbfd);
    font-weight: 900;
}

.retention-form-grid input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #ccd8e4;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
}

.retention-form-grid input:focus {
    border-color: var(--cyan, #43d6e8);
}

.retention-form-grid small {
    color: var(--muted, #5e6b7c);
    font-weight: 700;
    line-height: 1.35;
}

.retention-settings-form button,
.retention-run-form button {
    margin-top: 16px;
    padding: 13px 16px;
    border: none;
    border-radius: 13px;
    background: var(--navy, #0d1726);
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.retention-preview-box {
    margin-top: 20px;
    padding: 16px;
    border: 1px dashed var(--line, #d8e1ea);
    border-radius: 18px;
    background: var(--surface, #f9fbfd);
}

.retention-preview-box h4 {
    margin: 0 0 12px;
}

.retention-preview-box dl {
    margin: 0;
}

.retention-preview-box dt {
    color: var(--muted, #5e6b7c);
    font-size: 13px;
}

.retention-muted {
    margin-top: 12px !important;
    font-size: 14px;
}

body.theme-dark .admin-retention-panel,
body.theme-dark .retention-summary-grid article,
body.theme-dark .retention-preview-box,
body.theme-dark .retention-preview-box dl div,
body.theme-dark .retention-form-grid label {
    background: var(--dark-card, #101f35) !important;
    color: var(--dark-text, #f4f8ff) !important;
    border-color: var(--dark-border, #35506f) !important;
}

body.theme-dark .retention-form-grid input {
    background: #071322 !important;
    color: #ffffff !important;
    border-color: var(--dark-border, #35506f) !important;
}

body.theme-dark .retention-summary-grid small,
body.theme-dark .retention-form-grid small,
body.theme-dark .retention-preview-box dt,
body.theme-dark .retention-muted {
    color: var(--dark-muted, #b8c7dc) !important;
}

@media (max-width: 760px) {
    .retention-summary-grid,
    .retention-preview-box dl,
    .retention-form-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   MIVVI Volume 55: Production Database Option
========================================================= */

.admin-production-database-panel {
    grid-column: 1 / -1;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface, #ffffff);
    color: var(--text, var(--ink));
}

.admin-production-database-panel h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

.admin-production-database-panel > p {
    margin: 0 0 16px;
    color: var(--muted);
    line-height: 1.45;
}

.production-db-status-grid,
.production-db-count-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.production-db-status-grid article,
.production-db-count-grid article {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-2, #f9fbfd);
}

.production-db-status-grid span,
.production-db-count-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.production-db-status-grid strong,
.production-db-count-grid strong {
    display: block;
    margin-top: 7px;
    color: var(--text, var(--ink));
    font-size: 17px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.production-db-count-grid strong {
    font-size: 28px;
}

.production-db-path-box,
.production-db-config-box,
.production-db-warning-list {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-2, #f9fbfd);
}

.production-db-path-box p,
.production-db-warning-list p {
    margin: 0;
    color: var(--text, var(--ink));
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.production-db-path-box p + p,
.production-db-warning-list p + p {
    margin-top: 8px;
}

.production-db-config-box h4 {
    margin: 0 0 12px;
    font-size: 16px;
}

.production-db-config-box code {
    display: block;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #0d1726;
    color: #f4f8ff;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.production-db-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.production-db-actions form {
    margin: 0;
}

.production-db-actions button,
.production-db-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    background: var(--navy);
    color: #ffffff;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

.production-db-actions a {
    background: var(--cyan);
    color: var(--navy);
}

.production-db-warning-list {
    border-color: #f2d08a;
    background: #fff8ea;
}

.production-db-warning-list p {
    color: #6f4700;
    font-weight: 800;
}

body.theme-dark .admin-production-database-panel,
body.theme-dark .production-db-status-grid article,
body.theme-dark .production-db-count-grid article,
body.theme-dark .production-db-path-box,
body.theme-dark .production-db-config-box {
    background: var(--dark-card, #101f35) !important;
    color: var(--dark-text, #f4f8ff) !important;
    border-color: var(--dark-border, #35506f) !important;
}

body.theme-dark .production-db-warning-list {
    background: #30230d !important;
    border-color: #9b6b1f !important;
}

body.theme-dark .production-db-warning-list p,
body.theme-dark .production-db-path-box p,
body.theme-dark .production-db-status-grid strong,
body.theme-dark .production-db-count-grid strong {
    color: #f4f8ff !important;
}

body.theme-dark .production-db-status-grid span,
body.theme-dark .production-db-count-grid span {
    color: #b8c7dc !important;
}

@media (max-width: 760px) {
    .production-db-actions,
    .production-db-actions form,
    .production-db-actions button,
    .production-db-actions a {
        width: 100%;
    }
}

/* =========================================================
   MIVVI Volume 56 — Moderation Rules
========================================================= */

.admin-moderation-panel {
    grid-column: 1 / -1;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #ffffff;
}

.admin-moderation-panel h3,
.admin-moderation-panel h4 {
    margin: 0 0 8px;
}

.admin-moderation-panel > p {
    margin: 0 0 16px;
    color: var(--muted);
    line-height: 1.45;
}

.moderation-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.moderation-summary-grid article {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f9fbfd;
}

.moderation-summary-grid strong {
    display: block;
    font-size: 30px;
    line-height: 1;
}

.moderation-summary-grid span {
    display: block;
    margin-top: 7px;
    font-weight: 800;
}

.moderation-summary-grid small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    line-height: 1.3;
}

.moderation-rule-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) minmax(160px, 220px) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f9fbfd;
}

.moderation-rule-form label,
.moderation-rule-form span {
    display: block;
}

.moderation-rule-form span {
    margin-bottom: 7px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.moderation-rule-form input,
.moderation-rule-form select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #ccd8e4;
    border-radius: 12px;
    background: #ffffff;
    color: var(--ink);
    outline: none;
}

.moderation-rule-form input:focus,
.moderation-rule-form select:focus {
    border-color: var(--cyan);
}

.moderation-rule-form button,
.moderation-rule-actions button {
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    background: var(--navy);
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.moderation-rule-list,
.moderation-event-list {
    display: grid;
    gap: 12px;
}

.moderation-rule-card,
.moderation-event-row {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f9fbfd;
}

.moderation-rule-card header,
.moderation-event-row header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.moderation-rule-card strong,
.moderation-event-row strong {
    display: block;
}

.moderation-rule-card small,
.moderation-event-row small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.moderation-rule-block {
    border-left: 5px solid #dc2626;
}

.moderation-rule-flag {
    border-left: 5px solid var(--amber);
}

.moderation-rule-disabled {
    opacity: 0.72;
}

.moderation-status-pill {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eaf0f5;
    color: var(--ink);
    font-size: 12px;
    font-weight: 900;
}

.moderation-rule-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.moderation-rule-actions form {
    margin: 0;
}

.moderation-events-box {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.moderation-event-row p {
    margin: 8px 0 0;
    color: var(--ink);
    line-height: 1.4;
}

.moderation-event-block {
    border-left: 5px solid #dc2626;
}

.moderation-event-flag {
    border-left: 5px solid var(--amber);
}

body.theme-dark .admin-moderation-panel,
body.theme-dark .moderation-rule-form,
body.theme-dark .moderation-rule-card,
body.theme-dark .moderation-event-row,
body.theme-dark .moderation-summary-grid article,
body.theme-dark .moderation-events-box {
    background: var(--dark-card, #101f35) !important;
    color: var(--dark-text, #f4f8ff) !important;
    border-color: var(--dark-border, #35506f) !important;
}

body.theme-dark .moderation-rule-form input,
body.theme-dark .moderation-rule-form select {
    background: #071322 !important;
    color: #ffffff !important;
    border-color: var(--dark-border, #35506f) !important;
}

body.theme-dark .moderation-rule-form span,
body.theme-dark .moderation-event-row p,
body.theme-dark .moderation-rule-card strong,
body.theme-dark .moderation-event-row strong,
body.theme-dark .moderation-summary-grid strong,
body.theme-dark .moderation-summary-grid span {
    color: #ffffff !important;
}

body.theme-dark .moderation-rule-card small,
body.theme-dark .moderation-event-row small,
body.theme-dark .moderation-summary-grid small,
body.theme-dark .admin-moderation-panel > p {
    color: var(--dark-muted, #b8c7dc) !important;
}

body.theme-dark .moderation-status-pill {
    background: #173457 !important;
    color: #ffffff !important;
}

@media (max-width: 980px) {
    .moderation-summary-grid,
    .moderation-rule-form {
        grid-template-columns: 1fr;
    }

    .moderation-rule-form button,
    .moderation-rule-actions button {
        width: 100%;
    }
}

/* =========================================================
   MIVVI Pre-58 Cleanup: Conversation Sidebar Tools
   Moves pinned messages + export links away from the chat flow.
========================================================= */

@media (min-width: 1180px) {
    .app-shell {
        width: min(1380px, 96vw) !important;
    }

    .main-panel {
        padding-left: 28px !important;
        padding-right: 28px !important;
    }
}

.chat-card {
    min-height: 680px;
    overflow: hidden;
}

.chat-workspace-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 0;
    min-height: 0;
    height: 100%;
}

.chat-main-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--line, #d8e1ea);
}

.conversation-side-panel {
    min-width: 0;
    padding: 18px;
    background: var(--sidebar-tools-bg, #f4f7fa);
    overflow-y: auto;
}

.sidebar-tool-card {
    margin: 0 0 16px !important;
    padding: 16px !important;
    border: 1px solid var(--line, #d8e1ea) !important;
    border-radius: 18px !important;
    background: var(--card, #ffffff) !important;
}

.sidebar-tool-card:last-child {
    margin-bottom: 0 !important;
}

.conversation-side-panel .pinned-panel-header {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
}

.conversation-side-panel .pinned-panel-header h3,
.conversation-side-panel .conversation-export-panel h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
}

.conversation-side-panel .pinned-panel-header span,
.conversation-side-panel .conversation-export-panel p {
    margin: 0;
    color: var(--muted, #5e6b7c);
    font-size: 13px;
    line-height: 1.35;
}

.conversation-side-panel .pinned-list {
    display: grid;
    gap: 10px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 3px;
}

.conversation-side-panel .pinned-item {
    padding: 12px;
    border-radius: 14px;
}

.conversation-side-panel .pinned-item-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
}

.conversation-side-panel .pinned-item p {
    font-size: 13px;
    line-height: 1.35;
}

.conversation-side-panel .jump-to-message {
    width: 100%;
    margin-top: 6px;
}

.conversation-side-panel .conversation-export-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.conversation-side-panel .conversation-export-actions a {
    display: grid;
    place-items: center;
    min-height: 40px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 900;
}

.chat-main-column .message-search-panel,
.chat-main-column .mention-help-card,
.chat-main-column .owner-tools,
.chat-main-column .typing-indicator,
.chat-main-column .chat-form {
    flex: 0 0 auto;
}

.chat-main-column .message-list {
    flex: 1 1 auto;
    min-height: 360px;
}

body.theme-dark .chat-main-column {
    border-right-color: rgba(255, 255, 255, 0.12);
}

body.theme-dark .conversation-side-panel {
    background: #071322 !important;
}

body.theme-dark .sidebar-tool-card {
    background: #0d1b2e !important;
    border-color: #35506f !important;
    color: #f4f8ff !important;
}

body.theme-dark .conversation-side-panel .pinned-panel-header span,
body.theme-dark .conversation-side-panel .conversation-export-panel p,
body.theme-dark .conversation-side-panel .pinned-empty {
    color: #b8c7dc !important;
}

body.theme-dark .conversation-side-panel .pinned-item {
    background: #101f35 !important;
    border-color: #35506f !important;
    color: #f4f8ff !important;
}

body.theme-dark .conversation-side-panel .pinned-item p,
body.theme-dark .conversation-side-panel .pinned-item span,
body.theme-dark .conversation-side-panel .pinned-item strong {
    color: #f4f8ff !important;
}

body.theme-dark .conversation-side-panel .conversation-export-actions a {
    background: #173457 !important;
    color: #ffffff !important;
    border: 1px solid #4d6d94 !important;
}

body.theme-dark .conversation-side-panel .conversation-export-actions a:hover {
    background: var(--cyan, #43d6e8) !important;
    color: #03111f !important;
}

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

    .chat-main-column {
        border-right: none;
        border-bottom: 1px solid var(--line, #d8e1ea);
    }

    .conversation-side-panel {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        padding: 16px;
    }

    .sidebar-tool-card {
        margin: 0 !important;
    }

    .conversation-side-panel .pinned-list {
        max-height: 260px;
    }
}

@media (max-width: 760px) {
    .chat-card {
        min-height: 100vh;
        border-radius: 0;
    }

    .chat-workspace-layout {
        display: flex;
        flex-direction: column;
    }

    .chat-main-column .message-list {
        min-height: 52vh;
    }

    .conversation-side-panel {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .conversation-side-panel .pinned-list {
        max-height: 220px;
    }

    .conversation-side-panel .conversation-export-actions {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* =========================================================
   MIVVI Volume 58 — PWA / Installable App Prep
========================================================= */

.pwa-install-panel,
.admin-pwa-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #ffffff;
}

.pwa-install-panel h3,
.admin-pwa-panel h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

.pwa-install-panel p,
.admin-pwa-panel p {
    margin: 0 0 16px;
    color: var(--muted);
    line-height: 1.45;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 14px 0 18px;
}

.pwa-install-actions button {
    padding: 12px 16px;
    border: none;
    border-radius: 13px;
    background: var(--navy);
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.pwa-install-actions button:disabled {
    background: #d8e1ea;
    color: #6b7889;
    cursor: not-allowed;
}

.pwa-install-actions span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.pwa-readiness-grid,
.pwa-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.pwa-readiness-grid article,
.pwa-admin-grid article {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #f9fbfd;
}

.pwa-readiness-grid strong,
.pwa-admin-grid strong,
.pwa-admin-grid span,
.pwa-admin-grid small {
    display: block;
}

.pwa-readiness-grid strong,
.pwa-admin-grid strong {
    margin-bottom: 6px;
    color: var(--ink);
    font-weight: 900;
}

.pwa-readiness-grid span,
.pwa-admin-grid small,
.pwa-admin-note p {
    color: var(--muted);
    line-height: 1.4;
}

.pwa-admin-grid span {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pwa-admin-note {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #cfe1f2;
    border-radius: 15px;
    background: #f6fbff;
}

.pwa-admin-note p + p {
    margin-top: 8px;
}

body.theme-dark .pwa-install-panel,
body.theme-dark .admin-pwa-panel,
body.theme-dark .pwa-readiness-grid article,
body.theme-dark .pwa-admin-grid article,
body.theme-dark .pwa-admin-note {
    background: var(--surface, #101f35) !important;
    color: var(--text, #f4f8ff) !important;
    border-color: var(--border, #35506f) !important;
}

body.theme-dark .pwa-install-panel h3,
body.theme-dark .admin-pwa-panel h3,
body.theme-dark .pwa-readiness-grid strong,
body.theme-dark .pwa-admin-grid strong {
    color: var(--text, #ffffff) !important;
}

body.theme-dark .pwa-install-panel p,
body.theme-dark .admin-pwa-panel p,
body.theme-dark .pwa-install-actions span,
body.theme-dark .pwa-readiness-grid span,
body.theme-dark .pwa-admin-grid span,
body.theme-dark .pwa-admin-grid small,
body.theme-dark .pwa-admin-note p {
    color: var(--muted-text, #b8c7dc) !important;
}

body.theme-dark .pwa-install-actions button:disabled {
    background: #26364c !important;
    color: #9fb1c7 !important;
}

@media (max-width: 760px) {
    .pwa-install-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .pwa-install-actions button {
        width: 100%;
    }
}

/* =========================================================
   MIVVI Post-58 — Mobile Polish + Final Hosting Readiness
========================================================= */

.admin-hosting-readiness-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #ffffff;
}

.hosting-readiness-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.hosting-readiness-header h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

.hosting-readiness-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.hosting-overall {
    flex: 0 0 auto;
    padding: 9px 12px;
    border-radius: 999px;
    background: #eaf0f5;
    color: var(--navy);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hosting-overall-ready {
    background: #dcf6ec;
    color: #146345;
}

.hosting-overall-nearly-ready {
    background: #fff2c7;
    color: #744b00;
}

.hosting-overall-needs-action {
    background: #fde4e4;
    color: #8a1f1f;
}

.hosting-summary-grid,
.hosting-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.hosting-summary-grid {
    margin-bottom: 14px;
}

.hosting-summary-grid article,
.hosting-check-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #f9fbfd;
}

.hosting-summary-grid strong,
.hosting-summary-grid span,
.hosting-check-card span,
.hosting-check-card strong,
.hosting-check-card small {
    display: block;
}

.hosting-summary-grid strong {
    margin-bottom: 5px;
    font-size: 26px;
    line-height: 1;
}

.hosting-summary-grid span,
.hosting-check-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hosting-check-card strong {
    margin: 6px 0;
    color: var(--ink);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.hosting-check-card small {
    color: var(--muted);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.hosting-check-ready {
    border-left: 5px solid var(--green);
}

.hosting-check-warning {
    border-left: 5px solid var(--amber);
}

.hosting-check-action {
    border-left: 5px solid #b83232;
}

.hosting-mobile-notes,
.hosting-endpoint-box {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #d8e1ea;
    border-radius: 15px;
    background: #f6fbff;
}

.hosting-mobile-notes h4,
.hosting-endpoint-box h4 {
    margin: 0 0 8px;
}

.hosting-mobile-notes ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.55;
    font-weight: 700;
}

.hosting-endpoint-box p {
    margin: 0 0 8px;
    color: var(--muted);
}

.hosting-endpoint-box code {
    display: inline-block;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--navy);
    color: #ffffff;
    font-weight: 900;
}

.mobile-jump-latest {
    display: none;
}

/* Fluid desktop conversation layout */
.chat-card {
    min-width: 0;
}

.message-list {
    scroll-behavior: smooth;
}

.composer-main input,
.chat-form input,
.chat-form button,
.attachment-picker {
    min-height: 46px;
}

/* Keep the conversation tools usable without crowding the messages */
.conversation-side-panel {
    min-width: 0;
}

.sidebar-tool-card {
    overflow: hidden;
}

@media (max-width: 980px) {
    .hosting-readiness-header {
        flex-direction: column;
    }

    .hosting-overall {
        width: fit-content;
    }
}

@media (max-width: 760px) {
    body {
        min-height: 100svh;
    }

    .main-panel {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(18px, env(safe-area-inset-bottom));
    }

    .workspace-tabs,
    .notification-filter-tabs {
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 10px 0;
        backdrop-filter: blur(14px);
    }

    .chat-header {
        padding: 22px 20px 16px;
    }

    .message-search-panel,
    .mention-help-card,
    .message-list,
    .chat-form,
    .typing-indicator {
        padding-left: 18px;
        padding-right: 18px;
    }

    .message-list {
        min-height: 48svh;
        max-height: 58svh;
        padding-bottom: 20px;
    }

    .message {
        max-width: 94%;
    }

    .message-controls {
        gap: 8px;
    }

    .message-control,
    .message-reaction,
    .jump-to-message {
        min-height: 36px;
        padding-left: 11px;
        padding-right: 11px;
    }

    .chat-form {
        position: sticky;
        bottom: 0;
        z-index: 18;
        padding-top: 14px;
        padding-bottom: max(14px, env(safe-area-inset-bottom));
        box-shadow: 0 -12px 28px rgba(13, 23, 38, 0.12);
    }

    .composer-main {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 10px;
    }

    .composer-main input {
        min-width: 0;
        font-size: 16px;
    }

    .composer-main button {
        min-width: 78px;
    }

    .attachment-picker {
        width: 100%;
        justify-content: space-between;
        min-height: 44px;
    }

    .conversation-side-panel {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px 18px 20px;
    }

    .sidebar-tool-card {
        margin: 0 !important;
        padding: 16px !important;
        border-radius: 16px;
    }

    .mobile-jump-latest {
        position: sticky;
        bottom: 96px;
        z-index: 19;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: fit-content;
        margin: -46px auto 10px;
        padding: 10px 14px;
        border: none;
        border-radius: 999px;
        background: var(--navy);
        color: #ffffff;
        font-weight: 900;
        box-shadow: 0 12px 26px rgba(13, 23, 38, 0.22);
        cursor: pointer;
    }

    .mobile-jump-latest[hidden] {
        display: none !important;
    }

    .admin-console-grid,
    .settings-workspace-grid,
    .profile-page-grid,
    .invite-links-grid,
    .contacts-workspace-grid,
    .room-directory-grid {
        gap: 14px;
    }

    .admin-console-grid > section,
    .settings-workspace-grid > section,
    .profile-page-panel,
    .invite-links-panel,
    .contacts-panel,
    .room-directory-panel {
        padding: 16px !important;
        border-radius: 16px !important;
    }

    .hosting-summary-grid,
    .hosting-check-grid {
        grid-template-columns: 1fr;
    }
}

body.theme-dark .admin-hosting-readiness-panel,
body.theme-dark .hosting-summary-grid article,
body.theme-dark .hosting-check-card,
body.theme-dark .hosting-mobile-notes,
body.theme-dark .hosting-endpoint-box {
    background: var(--surface, #101f35) !important;
    color: var(--text, #f4f8ff) !important;
    border-color: var(--border, #35506f) !important;
}

body.theme-dark .hosting-readiness-header p,
body.theme-dark .hosting-summary-grid span,
body.theme-dark .hosting-check-card span,
body.theme-dark .hosting-check-card small,
body.theme-dark .hosting-mobile-notes ul,
body.theme-dark .hosting-endpoint-box p {
    color: var(--muted-text, #b8c7dc) !important;
}

body.theme-dark .hosting-check-card strong,
body.theme-dark .hosting-summary-grid strong,
body.theme-dark .hosting-mobile-notes h4,
body.theme-dark .hosting-endpoint-box h4 {
    color: var(--text, #ffffff) !important;
}

body.theme-dark .hosting-endpoint-box code,
body.theme-dark .mobile-jump-latest {
    background: var(--accent, #43d6e8) !important;
    color: #04111f !important;
}

