/* ═══════════════════════════════════════════
   CUC Intra — Stylesheet
   City Unity College Intranet
   ═══════════════════════════════════════════ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --accent: #f97316;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --chat-bg: #fafbfc;
    --text: #1a1a2e;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e5e7eb;
    --border-light: #f3f4f6;

    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 2px 12px rgba(0,0,0,.04);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --radius-full: 50%;

    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-nav: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    --gradient-hero: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    --gradient-chat-own: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-birthday: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* ─── Navigation ──────────────────────────── */
nav {
    background: var(--gradient-nav);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 60px;
}
.nav-brand {
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    margin-right: 2rem;
    text-decoration: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.nav-brand img { height: 34px; }
.nav-brand:hover { text-decoration: none; }
.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: .25rem;
    flex: 1;
}
.nav-links > li > a,
.nav-drop-btn {
    color: #c7d2fe;
    padding: .5rem .9rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 500;
    transition: all .15s;
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.nav-links > li > a:hover,
.nav-drop-btn:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav-links > li > a.active,
.open-group .nav-drop-btn { background: rgba(255,255,255,.15); color: #fff; }

/* Nav dropdowns */
.nav-dropdown { position: relative; }
.nav-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    padding: .4rem;
    list-style: none;
    z-index: 200;
}
.nav-dropdown.is-open .nav-submenu { display: block; }
.nav-submenu a {
    display: block;
    padding: .5rem .85rem;
    color: var(--text);
    font-size: .85rem;
    border-radius: var(--radius-xs);
    transition: background .15s;
}
.nav-submenu a:hover { background: var(--border-light); text-decoration: none; }
.nav-submenu a.active { background: #eef2ff; color: var(--primary); font-weight: 600; }

/* Nav toggle mobile */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: .3rem;
}
.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
}
.nav-backdrop.show { display: block; }

/* Nav user section */
.nav-user-section {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto !important;
}
.nav-user-info {
    color: #c7d2fe;
    font-size: .82rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.2);
}

/* ─── Notification Bell ───────────────────── */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: .4rem;
    border-radius: var(--radius-sm);
    transition: background .15s;
}
.notification-bell:hover { background: rgba(255,255,255,.1); }
.bell-icon { font-size: 1.2rem; }
.notification-badge {
    position: absolute;
    top: 2px;
    right: 0;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.notification-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-height: 400px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 300;
}
.notification-dropdown.show { display: block; }
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.notif-list { overflow-y: auto; max-height: 340px; }
.notif-item {
    display: flex;
    gap: .6rem;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: background .1s;
    color: var(--text);
}
.notif-item:hover { background: var(--border-light); text-decoration: none; }
.notif-item.unread { background: #eef2ff; }
.notif-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .1rem; }
.notif-msg { font-size: .82rem; line-height: 1.4; }
.notif-time { font-size: .72rem; color: var(--text-light); margin-top: .15rem; }

/* ─── Layout ──────────────────────────────── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

/* ─── Dashboard 3-column layout ───────────── */
.dashboard {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}
.dash-left, .dash-right { position: sticky; top: 76px; }

/* ─── Cards ───────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1rem;
}
.card-header {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-weight: 700;
    font-size: .9rem;
    color: var(--text);
}
.card-body { padding: 1rem; }
.card-footer {
    padding: .6rem 1rem;
    border-top: 1px solid var(--border-light);
    text-align: center;
}
.card-footer a { font-size: .82rem; font-weight: 600; }

/* ─── Profile Card (sidebar) ─────────────── */
.profile-card { text-align: center; }
.profile-card .card-body { padding: 1.5rem 1rem; }
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--primary-light);
    margin-bottom: .6rem;
}
.profile-name { font-weight: 700; font-size: 1rem; }
.profile-dept { color: var(--text-muted); font-size: .82rem; }
.profile-links {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    margin-top: .8rem;
    padding-top: .8rem;
    border-top: 1px solid var(--border-light);
}
.profile-links a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .7rem;
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: .85rem;
    transition: background .1s;
}
.profile-links a:hover { background: var(--border-light); text-decoration: none; }

/* ─── Birthday Card ───────────────────────── */
.birthday-card {
    background: var(--gradient-birthday);
    border: 2px solid #fbbf24;
}
.birthday-card .card-header { border-bottom-color: rgba(251,191,36,.3); }
.birthday-card .card-title { color: #92400e; }
.birthday-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 0;
}
.birthday-item + .birthday-item { border-top: 1px solid rgba(251,191,36,.2); }
.birthday-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid #fbbf24;
}
.birthday-name { font-weight: 600; font-size: .85rem; color: #92400e; }
.birthday-date { font-size: .75rem; color: #a16207; }
.birthday-today {
    animation: pulse 2s infinite;
    background: #fbbf24;
    color: #92400e;
    padding: .1rem .5rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    display: inline-block;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

/* ─── Online Users ────────────────────────── */
.online-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: var(--radius-full);
    display: inline-block;
    margin-right: .3rem;
}
.online-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem 0;
    font-size: .82rem;
}
.online-item-link {
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    padding: .35rem .4rem;
    margin: 0 -.4rem;
    transition: background .15s;
}
.online-item-link:hover {
    background: var(--border-light);
}
.online-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

/* ─── Chat Box ────────────────────────────── */
.chat-card { display: flex; flex-direction: column; }
.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: .8rem 1rem;
    background: var(--chat-bg);
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.chat-msg {
    display: flex;
    gap: .5rem;
    align-items: flex-end;
    max-width: 85%;
}
.chat-msg.own {
    flex-direction: row-reverse;
    align-self: flex-end;
}
.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}
.chat-bubble {
    padding: .5rem .85rem;
    border-radius: 18px;
    font-size: .85rem;
    line-height: 1.4;
    position: relative;
    max-width: 85%;
    width: fit-content;
    word-break: break-word;
}
.chat-msg:not(.own) .chat-bubble {
    background: var(--border-light);
    color: var(--text);
    border-bottom-left-radius: 4px;
}
.chat-msg.own .chat-bubble {
    background: var(--gradient-chat-own);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-sender {
    font-size: .7rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: .15rem;
}
.chat-sender-link {
    color: inherit;
    text-decoration: none;
}
.chat-sender-link:hover {
    text-decoration: underline;
}
.chat-time {
    font-size: .65rem;
    color: var(--text-light);
    margin-top: .15rem;
}
.chat-bubble-row {
    display: flex;
    align-items: center;
    gap: .3rem;
}
.chat-msg.own .chat-bubble-row {
    flex-direction: row-reverse;
}
.chat-like-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: .1rem;
    opacity: 0;
    transition: opacity .2s;
    line-height: 1;
    flex-shrink: 0;
}
.chat-msg:hover .chat-like-btn,
.chat-like-btn.liked {
    opacity: 1;
}
.chat-like-btn:hover .chat-like-icon {
    transform: scale(1.25);
}
.chat-like-icon {
    font-size: .7rem;
    transition: transform .15s;
    display: inline-block;
}
.chat-like-count {
    font-size: .6rem;
    font-weight: 600;
    color: var(--text-light);
}
.chat-msg.own .chat-time { color: rgba(255,255,255,.7); }
.chat-input-area {
    display: flex;
    gap: .5rem;
    padding: .75rem 1rem;
    border-top: 1px solid var(--border-light);
    background: #fff;
}
.chat-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: .5rem 1rem;
    font-size: .85rem;
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
}
.chat-input:focus { border-color: var(--primary-light); }
.chat-send-btn {
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: transform .1s;
    flex-shrink: 0;
}
.chat-send-btn:hover { transform: scale(1.05); }

/* ─── Emoji Picker ────────────────────────── */
.emoji-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: .2rem;
    line-height: 1;
    opacity: .6;
    transition: opacity .15s;
    flex-shrink: 0;
}
.emoji-toggle-btn:hover { opacity: 1; }
.emoji-picker-panel {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: .5rem;
    z-index: 100;
    width: 260px;
}
.emoji-picker-panel.show { display: block; }
.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    max-height: 200px;
    overflow-y: auto;
}
.emoji-pick {
    border: none;
    background: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: .25rem;
    border-radius: 6px;
    transition: background .1s;
    line-height: 1;
}
.emoji-pick:hover {
    background: var(--border-light);
    transform: scale(1.15);
}

/* ─── @Mention Picker ─────────────────────── */
.mention-picker {
    position: absolute;
    z-index: 200;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    max-width: 300px;
    overflow: hidden;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .7rem;
    cursor: pointer;
    transition: background .1s;
}
.mention-item:hover,
.mention-item.active {
    background: var(--border-light);
}
.mention-item-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.mention-item-info { min-width: 0; }
.mention-item-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mention-item-user {
    font-size: .7rem;
    color: var(--text-light);
}
.mention {
    color: var(--primary);
    font-weight: 600;
    background: rgba(99,102,241,.08);
    padding: .05rem .25rem;
    border-radius: 4px;
}

/* ─── Feed / Posts ─────────────────────────── */
.feed-post {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}
.feed-post:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.feed-post.pinned { border-left: 4px solid var(--primary); }
.post-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem 1rem .5rem;
}
.post-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border-light);
}
.post-author { font-weight: 700; font-size: .9rem; color: var(--text); }
.post-author:hover { color: var(--primary); text-decoration: none; }
.post-time { font-size: .75rem; color: var(--text-light); }
.post-menu-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-light);
    padding: .3rem;
    border-radius: var(--radius-xs);
}
.post-menu-btn:hover { background: var(--border-light); }
.post-pin-badge {
    font-size: .7rem;
    background: #eef2ff;
    color: var(--primary);
    padding: .1rem .5rem;
    border-radius: 12px;
    font-weight: 600;
    margin-left: auto;
}
.post-content {
    padding: .5rem 1rem 1rem;
    font-size: .92rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
.post-media {
    padding: 0;
}
.post-media img {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}
.post-media video {
    width: 100%;
    max-height: 500px;
    display: block;
    background: #000;
}
.post-media-grid {
    display: grid;
    gap: 2px;
}
.post-media-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.post-media-grid.grid-3 { grid-template-columns: 1fr 1fr; }
.post-media-grid.grid-3 > :first-child { grid-row: span 2; }
.post-media-grid.grid-4 { grid-template-columns: 1fr 1fr; }

.post-stats {
    padding: .5rem 1rem;
    display: flex;
    gap: 1rem;
    font-size: .82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
}
.post-actions {
    display: flex;
    border-top: 1px solid var(--border-light);
}
.post-action-btn {
    flex: 1;
    padding: .6rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: background .1s, color .1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font-family: inherit;
}
.post-action-btn:hover { background: var(--border-light); color: var(--primary); }
.post-action-btn.liked { color: var(--danger); }
.post-action-btn.reacted { color: var(--primary); font-weight: 600; }

/* Reaction Picker */
.reaction-btn-wrapper { position: relative; flex: 1; }
.reaction-picker {
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    display: none; background: var(--card-bg); border-radius: 24px;
    box-shadow: var(--shadow-lg); padding: .35rem .5rem; gap: .15rem; z-index: 50;
    white-space: nowrap;
}
.reaction-picker.show { display: flex; }
.reaction-picker button {
    font-size: 1.4rem; border: none; background: none; cursor: pointer;
    padding: .2rem .3rem; border-radius: 50%; transition: transform .15s;
}
.reaction-picker button:hover { transform: scale(1.35); }
.reaction-summary { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.reaction-badge {
    font-size: .78rem; background: var(--border-light); border-radius: 12px;
    padding: .15rem .45rem; white-space: nowrap;
}
.reaction-badge:hover { background: var(--border); }
.reaction-empty { font-size: .8rem; color: var(--text-light); }

/* ─── Reaction Users Modal ────────────────── */
.reaction-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.reaction-modal {
    background: var(--card-bg);
    border-radius: 14px;
    width: 340px;
    max-height: 70vh;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.reaction-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border-light);
    font-weight: 700;
    font-size: .95rem;
}
.reaction-modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}
.reaction-modal-body {
    overflow-y: auto;
    flex: 1;
}
.reaction-tabs {
    display: flex;
    gap: .25rem;
    padding: .5rem .7rem;
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
}
.reaction-tab {
    background: none;
    border: none;
    font-size: .78rem;
    font-weight: 600;
    padding: .3rem .6rem;
    border-radius: 16px;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text-muted);
    font-family: inherit;
}
.reaction-tab.active {
    background: var(--border-light);
    color: var(--text);
}
.reaction-users-list { padding: .3rem 0; }
.reaction-user-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem 1rem;
    text-decoration: none;
    color: var(--text);
    transition: background .1s;
}
.reaction-user-item:hover { background: var(--border-light); }
.reaction-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.reaction-user-name {
    flex: 1;
    font-size: .85rem;
    font-weight: 500;
}
.reaction-user-emoji {
    font-size: 1rem;
    flex-shrink: 0;
}

/* Post Comments */
.post-comments {
    padding: 0 1rem 1rem;
    background: var(--border-light);
}
.comment-item {
    display: flex;
    gap: .5rem;
    padding: .6rem 0;
}
.comment-item + .comment-item { border-top: 1px solid var(--border); }
.comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}
.comment-body {
    background: #fff;
    padding: .5rem .7rem;
    border-radius: var(--radius-sm);
    flex: 1;
}
.comment-author { font-weight: 600; font-size: .82rem; }
.comment-text { font-size: .82rem; margin-top: .15rem; }
.comment-time { font-size: .7rem; color: var(--text-light); margin-top: .2rem; }
.comment-form {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-top: .6rem;
    position: relative;
}
.comment-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: .4rem .8rem;
    font-size: .82rem;
    outline: none;
    background: #fff;
    font-family: inherit;
}
.comment-input:focus { border-color: var(--primary-light); }

/* Create Post */
.create-post {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    margin-bottom: 1rem;
}
.create-post-top {
    display: flex;
    gap: .6rem;
    align-items: center;
}
.create-post-input {
    flex: 1;
    border: none;
    background: var(--border-light);
    border-radius: 24px;
    padding: .6rem 1rem;
    font-size: .9rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: background .15s;
}
.create-post-input:hover { background: var(--border); }
.create-post-actions {
    display: flex;
    gap: .5rem;
    margin-top: .8rem;
    padding-top: .8rem;
    border-top: 1px solid var(--border-light);
}
.create-post-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .8rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: .85rem;
    color: var(--text-muted);
    border-radius: var(--radius-xs);
    font-weight: 500;
    transition: background .1s;
    font-family: inherit;
}
.create-post-btn:hover { background: var(--border-light); }

/* Post Create Modal / Generic Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff;
    border-radius: var(--radius);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: .3rem;
    border-radius: var(--radius-xs);
}
.modal-close:hover { background: var(--border-light); }
.modal-body { padding: 1.2rem; }
.modal-footer {
    padding: .8rem 1.2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

/* ─── Wiki ─────────────────────────────────── */
.wiki-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}
.wiki-cat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem;
    transition: transform .15s, box-shadow .15s;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text);
    border-left: 4px solid var(--primary);
}
.wiki-cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.wiki-cat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--border-light);
    flex-shrink: 0;
}
.wiki-cat-name { font-weight: 700; font-size: 1rem; }
.wiki-cat-count { font-size: .78rem; color: var(--text-muted); }

.wiki-article-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    line-height: 1.8;
    font-size: .95rem;
}
.wiki-article-content h2 { margin: 1.5rem 0 .8rem; font-size: 1.3rem; color: var(--primary-dark); border-bottom: 2px solid var(--border-light); padding-bottom: .3rem; }
.wiki-article-content h3 { margin: 1.2rem 0 .6rem; font-size: 1.1rem; }
.wiki-article-content p { margin-bottom: .8rem; }
.wiki-article-content ul, .wiki-article-content ol { padding-left: 1.5rem; margin-bottom: .8rem; }
.wiki-article-content blockquote { border-left: 4px solid var(--primary-light); padding: .5rem 1rem; background: #eef2ff; margin: 1rem 0; border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }
.wiki-article-content code { background: var(--border-light); padding: .15rem .4rem; border-radius: 4px; font-size: .88rem; }
.wiki-article-content pre { background: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; margin: 1rem 0; }
.wiki-article-content pre code { background: none; color: inherit; padding: 0; }
.wiki-article-content img { max-width: 100%; border-radius: var(--radius-sm); }
.wiki-article-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.wiki-article-content th, .wiki-article-content td { padding: .5rem .7rem; border: 1px solid var(--border); text-align: left; }
.wiki-article-content th { background: var(--border-light); font-weight: 600; }

/* Wiki TOC */
.wiki-toc {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    position: sticky;
    top: 76px;
}
.wiki-toc-title { font-weight: 700; font-size: .85rem; margin-bottom: .6rem; color: var(--text-muted); }
.wiki-toc ul { list-style: none; }
.wiki-toc li { padding: .25rem 0; }
.wiki-toc li a { font-size: .82rem; color: var(--text-muted); }
.wiki-toc li a:hover { color: var(--primary); text-decoration: none; }
.wiki-toc li.toc-sub { padding-left: 1rem; }

/* Wiki Search */
.wiki-search {
    position: relative;
    margin-bottom: 1.5rem;
}
.wiki-search input {
    width: 100%;
    padding: .75rem 1rem .75rem 2.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: .95rem;
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
}
.wiki-search input:focus { border-color: var(--primary-light); }
.wiki-search-icon {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* Wiki Editor */
.wiki-editor {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.wiki-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem;
    padding: .5rem;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
}
.wiki-toolbar button {
    background: #fff;
    border: 1px solid var(--border);
    padding: .3rem .6rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .82rem;
    transition: all .1s;
}
.wiki-toolbar button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.wiki-content-editable {
    min-height: 400px;
    padding: 1.5rem;
    outline: none;
    font-size: .95rem;
    line-height: 1.8;
}

/* ─── Breadcrumb ──────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.breadcrumb a { color: var(--primary); }
.breadcrumb-sep { color: var(--text-light); }

/* ─── Profile Page ────────────────────────── */
.profile-page {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: start;
}
.profile-big-card {
    text-align: center;
    padding: 2rem 1.5rem;
}
.profile-big-avatar {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 4px solid var(--primary-light);
    margin-bottom: 1rem;
}
.profile-big-name { font-size: 1.3rem; font-weight: 700; }
.profile-big-title { color: var(--text-muted); font-size: .9rem; margin-top: .2rem; }
.profile-big-dept { color: var(--primary); font-weight: 600; font-size: .85rem; margin-top: .3rem; }
.profile-info-list { text-align: left; margin-top: 1.2rem; border-top: 1px solid var(--border-light); padding-top: 1rem; }
.profile-info-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem 0;
    font-size: .85rem;
}
.profile-info-label { color: var(--text-muted); min-width: 80px; }

/* ─── Forms ───────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .35rem; color: var(--text); }
.form-control {
    width: 100%;
    padding: .55rem .8rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
    background: #fff;
}
.form-control:focus { border-color: var(--primary-light); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .75rem; color: var(--text-light); margin-top: .25rem; }

/* ─── Buttons ─────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--gradient-primary); color: #fff; }
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-secondary { background: var(--border-light); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ─── Badges ──────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .15rem .55rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
}
.badge-primary { background: #eef2ff; color: var(--primary); }
.badge-purple { background: #f3e8ff; color: #7c3aed; }
.badge-success { background: #ecfdf5; color: var(--success); }
.badge-danger { background: #fef2f2; color: var(--danger); }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-blue { background: #eff6ff; color: var(--info); }

/* ─── Alerts ──────────────────────────────── */
.alert {
    padding: .7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    margin-bottom: 1rem;
    animation: slideIn .3s ease;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ─── Tables ──────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
table.data-table th {
    text-align: left;
    padding: .7rem .8rem;
    background: var(--border-light);
    font-weight: 600;
    font-size: .82rem;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
table.data-table td {
    padding: .65rem .8rem;
    border-bottom: 1px solid var(--border-light);
}
table.data-table tr:hover td { background: #fafbfd; }

/* ─── Avatars ─────────────────────────────── */
.avatar-upload {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}
.avatar-upload img {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 4px solid var(--border-light);
}
.avatar-upload-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-full);
    border: 2px solid #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
}
.avatar-upload input[type="file"] { display: none; }

/* ─── Preset Avatar Gallery ──────────────── */
.preset-avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .6rem;
    max-height: 400px;
    overflow-y: auto;
    padding: .3rem;
}
.preset-avatar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    padding: .5rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
    transition: all .15s;
}
.preset-avatar-btn:hover {
    border-color: var(--primary);
    background: var(--border-light);
    transform: translateY(-2px);
}
.preset-avatar-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, .08);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, .2);
}
.preset-avatar-btn img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
}
.preset-avatar-label {
    font-size: .65rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    font-weight: 600;
}
@media (max-width: 480px) {
    .preset-avatar-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ─── Empty states ────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: .8rem; opacity: .5; }
.empty-state-text { font-size: .95rem; }

/* ─── Media Lightbox ──────────────────────── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.9);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}
.lightbox.show { display: flex; }
.lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
}
.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: .5rem;
    z-index: 10;
}
.lightbox-prev, .lightbox-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    color: #fff; font-size: 3rem; background: rgba(0,0,0,.4);
    border: none; cursor: pointer; padding: .5rem .8rem;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: background .2s; z-index: 10;
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(0,0,0,.7); }
.lightbox-counter {
    position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
    color: #fff; font-size: .85rem; background: rgba(0,0,0,.5);
    padding: .3rem .8rem; border-radius: 12px;
}

/* ─── Post Menu Dropdown ──────────────────── */
.post-menu {
    position: relative;
}
.post-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: .3rem;
    z-index: 100;
}
.post-menu-dropdown.show { display: block; }
.post-menu-dropdown a,
.post-menu-dropdown button {
    display: block;
    width: 100%;
    padding: .45rem .7rem;
    text-align: left;
    background: none;
    border: none;
    font-size: .82rem;
    color: var(--text);
    cursor: pointer;
    border-radius: var(--radius-xs);
    font-family: inherit;
}
.post-menu-dropdown a:hover,
.post-menu-dropdown button:hover { background: var(--border-light); text-decoration: none; }
.post-menu-dropdown .danger { color: var(--danger); }

/* ─── Login Page ──────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-nav);
    padding: 1rem;
}
.login-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}
.login-header {
    background: var(--gradient-hero);
    padding: 2rem;
    text-align: center;
    color: #fff;
}
.login-header img { height: 50px; margin-bottom: .8rem; }
.login-header h1 { font-size: 1.3rem; font-weight: 700; }
.login-header p { font-size: .85rem; opacity: .85; margin-top: .3rem; }
.login-body { padding: 2rem; }
.login-btn {
    width: 100%;
    padding: .75rem;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
    font-family: inherit;
}
.login-btn:hover { opacity: .9; }

/* ─── Install Page ────────────────────────── */
.install-page { min-height: 100vh; background: var(--bg); padding: 2rem; }
.install-card {
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.install-header {
    background: var(--gradient-hero);
    padding: 1.5rem 2rem;
    color: #fff;
    text-align: center;
}
.install-body { padding: 2rem; }
.install-steps {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
}
.install-step {
    flex: 1;
    text-align: center;
    padding: .5rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 3px solid var(--border);
}
.install-step.active { color: var(--primary); border-color: var(--primary); }
.install-step.done { color: var(--success); border-color: var(--success); }
.check-item { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; font-size: .88rem; }
.check-ok { color: var(--success); font-weight: 700; }
.check-fail { color: var(--danger); font-weight: 700; }

/* ─── Audit Log ───────────────────────────── */
.audit-item { display: flex; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid var(--border-light); font-size: .85rem; }
.audit-icon { font-size: 1rem; }
.audit-time { color: var(--text-light); font-size: .75rem; }

/* ─── Quick Post Widget ───────────────────── */
.quick-post textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .6rem;
    font-size: .85rem;
    resize: none;
    outline: none;
    min-height: 70px;
    font-family: inherit;
}
.quick-post textarea:focus { border-color: var(--primary-light); }

/* ─── Responsive ──────────────────────────── */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    .dash-left, .dash-right {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    .profile-page {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: #1e1b4b;
        flex-direction: column;
        padding: 1rem;
        z-index: 1001;
        overflow-y: auto;
        align-items: stretch;
    }
    .nav-links.show { display: flex; }
    .nav-links > li > a,
    .nav-drop-btn { padding: .7rem .85rem; width: 100%; text-align: left; }
    .nav-submenu {
        position: static;
        box-shadow: none;
        background: rgba(255,255,255,.05);
        border-radius: var(--radius-xs);
        margin-top: .3rem;
    }
    .nav-submenu a { color: #c7d2fe; }
    .nav-submenu a:hover { background: rgba(255,255,255,.1); }
    .nav-user-section { margin-left: 0 !important; flex-direction: column; align-items: flex-start; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.1); }

    .dash-left, .dash-right { grid-template-columns: 1fr; }

    .container { padding: 1rem; }
    .notification-dropdown { width: 280px; right: -2rem; }
    .wiki-categories { grid-template-columns: 1fr; }
}

/* ─── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ─── Textarea auto-resize utility ────────── */
.auto-resize { overflow: hidden; resize: none; }

/* ─── Loading spinner ─────────────────────── */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin: 1rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Notification permission banner ──────── */
.notif-banner {
    background: var(--gradient-primary);
    color: #fff;
    padding: .6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .85rem;
    gap: .5rem;
}
.notif-banner button {
    background: rgba(255,255,255,.2);
    color: #fff;
    border: none;
    padding: .35rem .8rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    font-family: inherit;
}
.notif-banner button:hover { background: rgba(255,255,255,.3); }
.notif-banner .dismiss { background: none; font-size: 1.1rem; padding: .2rem; }

/* ─── Announcements ──────────────────────── */
.announcement-banner {
    padding: .7rem 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1rem;
    font-size: .88rem;
    animation: slideIn .3s ease;
}
.announcement-normal { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.announcement-important { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.announcement-urgent { background: #fef2f2; color: #991b1b; border: 2px solid #fecaca; }

.announcement-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: transform .15s;
}
.announcement-card:hover { transform: translateY(-1px); }
.announcement-card.priority-urgent { border-left: 4px solid var(--danger); }
.announcement-card.priority-important { border-left: 4px solid var(--warning); }
.announcement-card.priority-normal { border-left: 4px solid var(--info); }

.ack-btn {
    background: var(--success);
    color: #fff;
    border: none;
    padding: .45rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity .15s;
}
.ack-btn:hover { opacity: .9; }
.ack-btn.acked {
    background: var(--border-light);
    color: var(--success);
    cursor: default;
}

.ack-progress {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}
.ack-progress-bar {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width .3s;
}

.priority-badge-urgent { background: #fef2f2; color: var(--danger); }
.priority-badge-important { background: #fffbeb; color: #d97706; }
.priority-badge-normal { background: #eff6ff; color: var(--info); }

/* ─── Polls ──────────────────────────────── */
.poll-widget { padding: .3rem 0; }
.poll-question { font-weight: 700; font-size: .95rem; margin-bottom: .6rem; color: var(--text); }
.poll-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .9rem;
    border: 2px solid #d1d5db;
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
    cursor: pointer;
    transition: all .2s;
    font-size: .88rem;
    overflow: hidden;
    background: var(--card-bg);
    user-select: none;
}
.poll-option:hover { border-color: var(--primary); background: #f5f3ff; }
.poll-option:hover .poll-radio { border-color: var(--primary); }
.poll-option.voted { border-color: var(--primary); background: #eef2ff; }
.poll-option.voted:hover { background: #e0e7ff; }
.poll-option.closed { cursor: default; pointer-events: none; opacity: .75; }
.poll-radio {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #b0b5c0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    flex-shrink: 0;
    z-index: 1;
}
.poll-option.voted .poll-radio {
    border-color: var(--primary);
    background: var(--primary);
}
.poll-option.voted .poll-radio::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
}
.poll-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(99, 102, 241, .15), rgba(99, 102, 241, .05));
    border-radius: var(--radius-sm);
    transition: width .5s ease;
    z-index: 0;
}
.poll-option.voted .poll-bar {
    background: linear-gradient(90deg, rgba(99, 102, 241, .28), rgba(99, 102, 241, .08));
}
.poll-option-text {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    flex: 1;
    min-width: 0;
}
.poll-option-text > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.poll-percentage { font-weight: 700; font-size: .82rem; color: var(--primary); white-space: nowrap; margin-left: .5rem; }
.poll-meta {
    display: flex;
    gap: 1rem;
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--border-light);
    align-items: center;
}
.poll-closed-badge {
    background: var(--border-light);
    color: var(--text-muted);
    padding: .15rem .6rem;
    border-radius: 12px;
    font-size: .72rem;
    font-weight: 600;
}
.poll-change-hint {
    font-size: .7rem;
    color: var(--text-light);
    text-align: center;
    margin-top: .15rem;
}
/* Compact widget variant */
.poll-option.poll-compact {
    padding: .45rem .65rem;
    gap: .45rem;
    font-size: .82rem;
    margin-bottom: .35rem;
}
.poll-compact .poll-radio { width: 15px; height: 15px; min-width: 15px; }
.poll-compact .poll-radio::after { width: 5px; height: 5px; }
.poll-compact .poll-percentage { font-size: .75rem; }

/* ─── Direct Messages ────────────────────── */
.dm-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    height: calc(100vh - 130px);
    min-height: 500px;
}
.dm-sidebar {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.dm-sidebar-header {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dm-sidebar-header h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.dm-conv-list { flex: 1; overflow-y: auto; }
.dm-conv-item {
    display: flex;
    gap: .6rem;
    padding: .7rem 1rem;
    cursor: pointer;
    transition: background .1s;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text);
    align-items: center;
}
.dm-conv-item:hover { background: var(--border-light); text-decoration: none; }
.dm-conv-item.active { background: #eef2ff; }
.dm-conv-item.has-unread { background: #f0f4ff; }
.dm-conv-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.dm-conv-info { flex: 1; min-width: 0; }
.dm-conv-name {
    font-weight: 600;
    font-size: .88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dm-conv-time { font-size: .7rem; color: var(--text-light); font-weight: 400; }
.dm-conv-preview {
    font-size: .8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: .1rem;
}
.dm-conv-unread {
    background: var(--primary);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}
.dm-chat-area { display: flex; flex-direction: column; }
.dm-chat-header {
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.dm-chat-header-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.dm-chat-header-name { font-weight: 700; font-size: .92rem; }
.dm-messages {
    flex: 1;
    overflow-y: auto;
    padding: .8rem 1rem;
    background: var(--chat-bg);
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.dm-input-area {
    display: flex;
    gap: .5rem;
    padding: .75rem 1rem;
    border-top: 1px solid var(--border-light);
    background: #fff;
}
.dm-indicator {
    position: relative;
    cursor: pointer;
    padding: .4rem;
    border-radius: var(--radius-sm);
    transition: background .15s;
}
.dm-indicator:hover { background: rgba(255,255,255,.1); }
.dm-user-picker { max-height: 300px; overflow-y: auto; }
.dm-user-option {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .7rem;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: background .1s;
    text-decoration: none;
    color: var(--text);
}
.dm-user-option:hover { background: var(--border-light); text-decoration: none; }

/* ─── Dashboard Search Widget ────────────── */
.dash-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}
.search-group { padding: .3rem 0; }
.search-group + .search-group { border-top: 1px solid var(--border-light); }
.search-group-title {
    padding: .4rem 1rem;
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.search-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 1rem;
    color: var(--text);
    transition: background .1s;
    text-decoration: none;
}
.search-item:hover { background: var(--border-light); text-decoration: none; }
.search-item-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.search-item-title { font-size: .85rem; font-weight: 500; }
.search-item-sub { font-size: .75rem; color: var(--text-muted); }
.search-item mark { background: #fef08a; color: inherit; padding: 0 .1rem; border-radius: 2px; }
.search-view-all {
    display: block;
    text-align: center;
    padding: .6rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--primary);
    border-top: 1px solid var(--border-light);
    text-decoration: none;
}
.search-view-all:hover { background: var(--border-light); text-decoration: none; }

/* Full search results page */
.search-results-section { margin-bottom: 1.5rem; }
.search-results-section h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .6rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.search-result-card {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    margin-bottom: .5rem;
    box-shadow: var(--shadow-sm);
    transition: transform .1s;
}
.search-result-card:hover { transform: translateY(-1px); }
.search-result-card mark { background: #fef08a; padding: 0 .15rem; border-radius: 2px; }

/* ─── Modal Content (used in DM, polls, announcements, avatar picker) */
.modal-content {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideIn .2s ease;
}
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(-15px) scale(.97); } to { opacity: 1; transform: none; } }

/* ─── Notification Permission Banner ─────── */
.notif-permission-banner {
    display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
    padding: .8rem 1.2rem; margin-bottom: 1rem; border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-size: .88rem; font-weight: 500;
    box-shadow: 0 4px 12px rgba(99,102,241,.3);
    animation: slideDown .3s ease-out;
}
.notif-permission-banner .btn { font-size: .78rem; padding: .3rem .8rem; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ─── @Mention Styling ──────────────────── */
.mention { color: var(--primary); font-weight: 600; }

/* ─── Link Preview (Compose) ────────────── */
.link-preview-compose {
    position: relative; border: 1px solid var(--border); border-radius: 12px;
    overflow: hidden; margin: .6rem 0 .3rem; background: var(--card-bg);
}
.link-preview-remove {
    position: absolute; top: .4rem; right: .4rem; z-index: 2;
    width: 24px; height: 24px; border-radius: 50%; border: none;
    background: rgba(0,0,0,.5); color: #fff; font-size: 1rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
.link-preview-remove:hover { background: rgba(0,0,0,.7); }
.link-preview-thumbs {
    display: flex; gap: .5rem; padding: .6rem; overflow-x: auto;
    background: var(--bg); border-bottom: 1px solid var(--border-light);
}
.link-thumb-option {
    width: 80px; height: 60px; object-fit: cover; border-radius: 6px;
    cursor: pointer; border: 2px solid transparent; flex-shrink: 0;
    transition: border-color .2s, opacity .2s; opacity: .7;
}
.link-thumb-option:hover { opacity: 1; }
.link-thumb-option.selected { border-color: var(--primary); opacity: 1; }
.link-preview-info { padding: .6rem .8rem; }
.link-preview-title { font-weight: 700; font-size: .9rem; margin-bottom: .2rem; }
.link-preview-desc { font-size: .82rem; color: var(--text-muted); margin-bottom: .2rem; }
.link-preview-domain { font-size: .75rem; color: var(--text-light); }

/* ─── Link Preview Card (Display) ───────── */
.link-preview-card {
    display: flex; border: 1px solid var(--border); border-radius: 12px;
    overflow: hidden; margin: .5rem 0; text-decoration: none; color: inherit;
    background: var(--card-bg); transition: box-shadow .2s;
}
.link-preview-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.link-preview-card-img { width: 200px; min-height: 120px; object-fit: cover; flex-shrink: 0; }
.link-preview-card-body { padding: .8rem; flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.link-preview-card-title {
    font-weight: 700; font-size: .9rem; margin-bottom: .3rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-preview-card-desc {
    font-size: .82rem; color: var(--text-muted); margin-bottom: .3rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.link-preview-card-domain { font-size: .75rem; color: var(--text-light); }
@media (max-width: 480px) {
    .link-preview-card { flex-direction: column; }
    .link-preview-card-img { width: 100%; height: 160px; }
}

/* ─── Floating DM Widget (Facebook classic chat tab) ─── */
.dm-widget { position: fixed; bottom: 0; right: 20px; z-index: 1000; width: 280px; }

/* The tab bar — always visible at bottom */
.dm-fab {
    display: flex; align-items: center; gap: .5rem;
    width: 100%; padding: 0 12px; height: 34px;
    background: #4267B2; color: #fff;
    font-size: .82rem; font-weight: 600; font-family: inherit;
    border: none; border-radius: 6px 6px 0 0;
    cursor: pointer; position: relative;
    box-shadow: 0 -1px 6px rgba(0,0,0,.2);
    transition: background .15s;
    box-sizing: border-box;
}
.dm-fab:hover { background: #365899; }
.dm-fab::before { display: none; }
.dm-fab-label { display: none; }

.dm-fab-badge {
    min-width: 18px; height: 18px;
    background: #FA3E3E; color: #fff; font-size: .65rem; font-weight: 700;
    border-radius: 9px; display: none; align-items: center; justify-content: center;
    padding: 0 5px; margin-left: auto;
}
.dm-fab-badge.show { display: inline-flex; }

/* Chat panel — opens above the tab */
.dm-panel {
    position: absolute; bottom: 34px; left: 0; right: 0; width: 100%; height: 400px;
    background: var(--card-bg); border-radius: 6px 6px 0 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.08);
    display: flex; flex-direction: column; overflow: hidden;
    animation: dmSlideUp .15s ease;
}
@keyframes dmSlideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dm-panel-header {
    display: flex; align-items: center; gap: .5rem; padding: .55rem .8rem;
    background: #4267B2; color: #fff; font-weight: 600; font-size: .84rem;
    flex-shrink: 0;
}
.dm-panel-header button {
    background: rgba(255,255,255,.2); border: none; color: #fff; width: 28px; height: 28px;
    border-radius: 50%; cursor: pointer; font-size: .85rem; display: flex;
    align-items: center; justify-content: center; transition: background .15s;
}
.dm-panel-header button:hover { background: rgba(255,255,255,.35); }
.dm-panel-header .dm-hdr-title { flex: 1; }
.dm-panel-header .dm-hdr-back {
    background: none; font-size: 1.1rem; width: auto; padding: 0 .3rem;
}

.dm-panel-search {
    padding: .5rem .7rem; border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.dm-panel-search input {
    width: 100%; padding: .4rem .7rem; border: 1px solid var(--border); border-radius: 20px;
    font-size: .8rem; font-family: inherit; background: var(--bg); color: var(--text);
    box-sizing: border-box; outline: none;
}
.dm-panel-search input:focus { border-color: var(--primary-light); }

.dm-panel-list { flex: 1; overflow-y: auto; }
.dm-panel-conv {
    display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem;
    cursor: pointer; transition: background .12s; border-bottom: 1px solid var(--border-light);
}
.dm-panel-conv:hover { background: #f5f3ff; }
.dm-panel-conv.unread { background: #f0f4ff; }
.dm-panel-conv-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.dm-panel-conv-info { flex: 1; min-width: 0; }
.dm-panel-conv-name { font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-panel-conv-preview { font-size: .74rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-panel-conv.unread .dm-panel-conv-name { color: var(--primary-dark); }
.dm-panel-conv.unread .dm-panel-conv-preview { color: var(--text); font-weight: 500; }
.dm-panel-conv-meta { text-align: right; flex-shrink: 0; }
.dm-panel-conv-time { font-size: .65rem; color: var(--text-light); white-space: nowrap; }
.dm-panel-conv-badge {
    background: var(--primary); color: #fff; font-size: .62rem; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex;
    align-items: center; justify-content: center; padding: 0 4px; margin-top: .2rem;
}

.dm-panel-messages {
    flex: 1; overflow-y: auto; padding: .6rem; display: flex; flex-direction: column;
    gap: .25rem; background: var(--chat-bg);
}
.dm-panel-msg { display: flex; gap: .4rem; max-width: 82%; }
.dm-panel-msg.own { flex-direction: row-reverse; align-self: flex-end; }
.dm-panel-msg-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; align-self: flex-end; }
.dm-panel-msg-bubble {
    padding: .4rem .7rem; border-radius: 14px; font-size: .82rem; line-height: 1.35;
    word-break: break-word;
}
.dm-panel-msg:not(.own) .dm-panel-msg-bubble { background: #e8eaed; color: var(--text); border-bottom-left-radius: 4px; }
.dm-panel-msg.own .dm-panel-msg-bubble { background: var(--gradient-primary); color: #fff; border-bottom-right-radius: 4px; }
.dm-panel-msg-time { font-size: .6rem; color: var(--text-light); margin-top: .1rem; text-align: right; }
.dm-panel-msg.own .dm-panel-msg-time { text-align: right; }

.dm-panel-input {
    display: flex; gap: .4rem; padding: .5rem .6rem; border-top: 1px solid var(--border-light);
    flex-shrink: 0; background: var(--card-bg);
}
.dm-panel-input input {
    flex: 1; padding: .45rem .75rem; border: 1px solid var(--border); border-radius: 20px;
    font-size: .82rem; font-family: inherit; background: var(--bg); color: var(--text);
    outline: none; box-sizing: border-box;
}
.dm-panel-input input:focus { border-color: var(--primary-light); }
.dm-panel-input button {
    width: 34px; height: 34px; border-radius: 50%; border: none;
    background: var(--gradient-primary); color: #fff; font-size: .9rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: transform .15s;
}
.dm-panel-input button:hover { transform: scale(1.06); }

.dm-panel-empty {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; color: var(--text-light); font-size: .85rem; gap: .3rem;
}
.dm-panel-empty-icon { font-size: 2rem; }

.dm-panel-user {
    display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem;
    cursor: pointer; transition: background .12s;
}
.dm-panel-user:hover { background: #f5f3ff; }
.dm-panel-user img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.dm-panel-user-name { font-size: .82rem; font-weight: 600; }
.dm-panel-user-dept { font-size: .72rem; color: var(--text-muted); }

@media (max-width: 480px) {
    .dm-widget { right: 0; left: auto; width: 220px; }
    .dm-panel { width: 100vw; height: 70vh; bottom: 34px; right: 0; left: auto; border-radius: 6px 6px 0 0; }
}

/* ─── Strikes ────────────────────────────── */
.strike-item {
    border-left: 3px solid; padding: .5rem .8rem; margin-bottom: .4rem;
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0; background: var(--card-bg);
}
.strike-today { background: #fef9c3; }
.strike-date-group {
    font-weight: 700; font-size: .82rem; margin: .8rem 0 .4rem;
    color: var(--text-muted); display: flex; align-items: center; gap: .4rem;
}
.strike-date-group:first-child { margin-top: 0; }
.strike-category-badge {
    font-size: .68rem; padding: .1rem .4rem; border-radius: 8px;
    color: #fff; display: inline-block; white-space: nowrap;
}
.strike-summary { font-size: .85rem; font-weight: 500; }
.strike-desc {
    font-size: .78rem; color: var(--text-muted); margin-top: .2rem;
    display: none; line-height: 1.5;
}
.strike-desc.show { display: block; }
.strike-toggle {
    font-size: .72rem; color: var(--primary); cursor: pointer; border: none;
    background: none; padding: 0; margin-top: .15rem;
}
.strike-filters {
    display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.strike-filter-btn {
    padding: .35rem .8rem; border-radius: 20px; border: 1px solid var(--border);
    background: var(--card-bg); font-size: .82rem; cursor: pointer;
    font-family: inherit; transition: all .15s;
}
.strike-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.strike-filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.strike-empty {
    text-align: center; padding: 2rem 1rem; color: var(--text-light); font-size: .9rem;
}
.strike-source {
    text-align: center; padding: 1rem; font-size: .75rem; color: var(--text-light);
    border-top: 1px solid var(--border-light); margin-top: 1rem;
}

/* ─── Gallery ────────────────────────────── */
.gallery-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.2rem;
}
.album-card {
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; transition: transform .2s, box-shadow .2s;
    text-decoration: none; color: inherit; display: block;
}
.album-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.album-card-cover {
    width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--border-light);
    display: block;
}
.album-card-body { padding: .8rem 1rem; }
.album-card-title { font-weight: 700; font-size: .95rem; margin-bottom: .2rem; }
.album-card-meta { font-size: .78rem; color: var(--text-muted); display: flex; gap: .6rem; }

.photo-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .8rem;
}
.photo-grid-item {
    position: relative; aspect-ratio: 1; overflow: hidden;
    border-radius: var(--radius-sm); cursor: pointer;
}
.photo-grid-item img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .2s;
}
.photo-grid-item:hover img { transform: scale(1.05); }
.photo-grid-item .photo-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,.4);
    opacity: 0; transition: opacity .2s; display: flex;
    align-items: flex-end; justify-content: flex-end; padding: .4rem;
    pointer-events: none;
}
.photo-grid-item:hover .photo-overlay { pointer-events: auto; }
.photo-grid-item:hover .photo-overlay { opacity: 1; }
.photo-overlay button {
    background: rgba(255,255,255,.9); border: none; border-radius: 50%;
    width: 30px; height: 30px; cursor: pointer; font-size: .8rem;
    display: flex; align-items: center; justify-content: center;
    margin-left: .3rem;
}

.gallery-dropzone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 2rem; text-align: center; color: var(--text-muted);
    cursor: pointer; transition: border-color .2s, background .2s;
    margin-bottom: 1.2rem;
}
.gallery-dropzone.dragover {
    border-color: var(--primary); background: rgba(99,102,241,.06);
}
.gallery-dropzone input[type="file"] { display: none; }

.space-savings {
    background: #fef9c3; border: 1px solid #fde68a; border-radius: var(--radius-sm);
    padding: .6rem 1rem; font-size: .85rem; display: flex;
    align-items: center; gap: .5rem; margin-bottom: 1rem;
}

.gallery-upload-progress {
    background: var(--border-light); border-radius: 4px; height: 6px; margin-top: .5rem; overflow: hidden;
}
.gallery-upload-progress-bar {
    height: 100%; background: var(--gradient-primary); border-radius: 4px;
    transition: width .3s;
}

/* ─── Responsive additions ───────────────── */
@media (max-width: 768px) {
    .dm-container { grid-template-columns: 1fr; height: auto; }
    .dm-sidebar { max-height: 250px; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .lightbox-prev, .lightbox-next { font-size: 2rem; padding: .3rem .5rem; }
}

/* ── View All Comments ────────────────────── */
.view-all-comments {
    display: block;
    text-align: center;
    padding: .5rem;
    font-size: .82rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.view-all-comments:hover { text-decoration: underline; }

/* ── Image Edit / Rotation ────────────────── */
.post-image-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    overflow: hidden;
}
.post-image-wrapper img { display: block; width: 100%; transition: transform .3s; }
.post-image-wrapper.editing { outline: 2px solid var(--primary); border-radius: 6px; overflow: visible; }
.post-image-wrapper.editing img { opacity: .92; }

/* Edit pencil button */
.img-edit-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s, background .2s;
    z-index: 2;
}
.post-image-wrapper:hover .img-edit-btn { opacity: 1; }
.img-edit-btn:hover { background: rgba(99,102,241,.85); }

/* Edit toolbar (rotate left, rotate right, save, cancel) */
.img-edit-toolbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: rgba(0,0,0,.65);
    z-index: 3;
}
.img-tb-btn {
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 14px;
    cursor: pointer;
    color: #fff;
    background: rgba(255,255,255,.18);
    transition: background .15s;
}
.img-tb-btn:hover { background: rgba(255,255,255,.32); }
.img-tb-btn:disabled { opacity: .5; cursor: default; }
.img-tb-btn.save { background: var(--primary); font-weight: 600; }
.img-tb-btn.save:hover { background: #4f46e5; }
.img-tb-btn.cancel { background: rgba(239,68,68,.7); }
.img-tb-btn.cancel:hover { background: rgba(239,68,68,.9); }

/* Upload Previews */
.upload-previews {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-light);
}
.upload-preview-item {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-light);
}
.upload-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.upload-preview-item .img-rotate-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s, background .2s;
    z-index: 2;
    line-height: 1;
}
.upload-preview-item:hover .img-rotate-btn { opacity: 1; }
.img-rotate-btn:hover { background: rgba(99,102,241,.85); }
.img-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(239,68,68,.8);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
    z-index: 2;
    line-height: 1;
}
.upload-preview-item:hover .img-remove-btn { opacity: 1; }

/* Grid fix: wrapper inside grid */
.post-media-grid .post-image-wrapper { width: 100%; height: 100%; }
.post-media-grid .post-image-wrapper img { height: 100%; object-fit: cover; }
