/* ── Variables ────────────────────────────────────────────────── */
:root {
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2535;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #e8eaf0;
  --text2: #8892a4;
  --text3: #5c6578;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --accent-glow: rgba(88,101,242,0.25);
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --topbar-h: 60px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
input, textarea, select, button { font-family: inherit; }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
  backdrop-filter: blur(20px);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 16px;
}
.brand-name {
  font-family: 'Syne', sans-serif; font-weight: 700;
  font-size: 14px; letter-spacing: 1px;
  color: var(--text); white-space: nowrap;
}
.topbar-links {
  display: flex; align-items: center; gap: 4px;
  flex: 1; overflow-x: auto; scrollbar-width: none;
}
.topbar-links::-webkit-scrollbar { display: none; }
.nav-link-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--text2);
  transition: all .15s; white-space: nowrap;
  border: 1px solid transparent;
}
.nav-link-item:hover {
  background: var(--bg3); color: var(--text);
  border-color: var(--border2);
}
.nav-link-icon { font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.admin-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--text2);
  border: 1px solid var(--border);
  transition: all .15s;
}
.admin-btn:hover { background: var(--bg3); color: var(--text); }
.user-menu { display: flex; align-items: center; gap: 4px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 30px; border: 1px solid var(--border);
  transition: all .15s;
}
.user-chip:hover { background: var(--bg3); }
.user-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0;
}
.user-info-sm { display: flex; flex-direction: column; }
.user-name-sm { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-dept-sm { font-size: 11px; color: var(--text3); line-height: 1.2; }
.logout-btn {
  width: 32px; height: 32px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); border: 1px solid var(--border);
  transition: all .15s;
}
.logout-btn:hover { color: var(--red); border-color: var(--red); }

/* ── Flash messages ─────────────────────────────────────────── */
.flash-container { padding: 0 20px; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.flash {
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
}
.flash-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.flash-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }

/* ── Common elements ────────────────────────────────────────── */
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff; flex-shrink: 0;
}
.user-avatar-xs {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; color: #fff; flex-shrink: 0;
}
.user-avatar-xs.avatar-img { object-fit: cover; }
.dept-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; background: rgba(88,101,242,0.2); color: #818cf8;
  border: 1px solid rgba(88,101,242,0.3);
}
.visibility-tag {
  font-size: 10px; font-weight: 500; padding: 2px 6px;
  border-radius: 4px; background: rgba(245,158,11,0.15); color: #fbbf24;
}
.btn-primary {
  background: var(--accent); color: #fff;
  padding: 8px 18px; border-radius: 8px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary {
  background: transparent; color: var(--text2);
  padding: 8px 18px; border-radius: 8px;
  border: 1px solid var(--border2); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s; display: inline-block;
}
.btn-secondary:hover { background: var(--bg3); color: var(--text); }
.btn-full { width: 100%; }
.btn-sm {
  padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500;
  background: var(--bg3); color: var(--text2); border: 1px solid var(--border);
  cursor: pointer; transition: all .15s;
}
.btn-sm:hover { color: var(--text); border-color: var(--border2); }
.btn-danger { background: rgba(239,68,68,0.1) !important; color: var(--red) !important; border-color: rgba(239,68,68,0.2) !important; }
.btn-danger:hover { background: rgba(239,68,68,0.2) !important; }

/* ── Login ──────────────────────────────────────────────────── */
.login-page { display: flex; height: 100vh; overflow: hidden; }
.login-container { display: flex; width: 100%; height: 100%; }
.login-left {
  width: 420px; flex-shrink: 0;
  background: linear-gradient(145deg, #0d1021, #141830);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 24px;
  position: relative; overflow: hidden;
  border-right: 1px solid var(--border);
}
.login-left::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(88,101,242,0.2) 0%, transparent 70%);
}
.login-brand { text-align: center; z-index: 1; }
.login-logo {
  width: 72px; height: 72px; border-radius: 20px;
  background: var(--accent); color: #fff; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 32px;
  box-shadow: 0 0 40px var(--accent-glow);
}
.login-title {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 22px; letter-spacing: 2px; color: var(--text);
  text-align: center; word-break: break-word;
}
.login-subtitle { color: var(--text3); font-size: 14px; margin-top: 4px; }
.login-deco {
  width: 200px; height: 200px; border-radius: 50%;
  border: 1px solid rgba(88,101,242,0.15); position: absolute;
  bottom: -60px; right: -60px;
}
.login-right {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-form-wrap { width: 100%; max-width: 380px; }
.login-form-wrap h2 { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.login-hint { color: var(--text3); font-size: 14px; margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text2); }
.form-group input, .form-group select, .form-group textarea {
  background: var(--bg2); border: 1px solid var(--border2);
  color: var(--text); padding: 10px 14px; border-radius: 8px;
  font-size: 14px; outline: none; transition: border .15s;
  width: 100%;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.login-footer-note { margin-top: 16px; font-size: 12px; color: var(--text3); text-align: center; }

/* ── Home layout ────────────────────────────────────────────── */
.page-content { padding: 20px; }
.home-layout {
  display: grid;
  grid-template-columns: 280px 1fr 240px;
  gap: 20px; max-width: 1200px; margin: 0 auto;
  align-items: start;
}

/* ── Widgets / sidebar ──────────────────────────────────────── */
.widget-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}
.widget-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
}
.widget-header h3 { font-size: 13px; font-weight: 700; flex: 1; }
.widget-icon { font-size: 16px; }
.weather-location { font-size: 11px; color: var(--text3); }
.weather-body { padding: 16px; }
.weather-loading { color: var(--text3); font-size: 13px; }
.weather-main { display: flex; align-items: center; gap: 12px; }
.weather-icon-big { font-size: 42px; }
.weather-temp { font-family: 'Syne', sans-serif; font-size: 36px; font-weight: 700; }
.weather-desc { color: var(--text2); font-size: 13px; margin-top: 6px; }
.weather-details { color: var(--text3); font-size: 12px; margin-top: 4px; }
.weather-na { color: var(--text3); font-size: 12px; }

/* Events */
.events-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.event-item {
  display: flex; gap: 10px; padding: 10px;
  border-radius: 8px; background: var(--bg3);
  border-left: 3px solid var(--evt-color, var(--accent));
}
.event-date-badge {
  display: flex; flex-direction: column; align-items: center;
  min-width: 34px;
}
.evt-day { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 800; line-height: 1; }
.evt-month { font-size: 9px; font-weight: 600; color: var(--text3); text-transform: uppercase; }
.event-info { flex: 1; }
.event-title { font-size: 13px; font-weight: 600; }
.event-meta { font-size: 11px; color: var(--text3); }
.event-dept-tag { font-size: 10px; color: var(--accent); }
.empty-state-sm { padding: 16px; font-size: 12px; color: var(--text3); text-align: center; }

/* ── Feed center ────────────────────────────────────────────── */
.feed-center { display: flex; flex-direction: column; gap: 16px; }

/* Composer */
.post-composer {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.composer-top { display: flex; gap: 12px; }
.composer-input-wrap { flex: 1; }
.composer-input-wrap textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 10px 14px; border-radius: 8px;
  font-size: 14px; resize: none; outline: none; transition: border .15s;
  min-height: 80px;
}
.composer-input-wrap textarea:focus { border-color: var(--accent); }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.dept-select {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); padding: 6px 10px; border-radius: 6px;
  font-size: 13px; outline: none; cursor: pointer;
}
.btn-post {
  background: var(--accent); color: #fff;
  padding: 7px 20px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.btn-post:hover { background: var(--accent-hover); }

/* Post card */
.post-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s;
  margin-bottom: 16px;
}
.post-card:hover { border-color: var(--border2); }
.post-header { display: flex; align-items: flex-start; padding: 18px 20px 12px; gap: 12px; }
.post-author { display: flex; align-items: flex-start; gap: 12px; flex: 1; }
.author-name { font-weight: 600; font-size: 14px; }
.author-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.post-time { font-size: 11px; color: var(--text3); }
.post-delete-btn {
  background: none; border: none; color: var(--text3); font-size: 18px;
  cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: all .15s;
  flex-shrink: 0;
}
.post-delete-btn:hover { color: var(--red); background: rgba(239,68,68,0.1); }
.post-content { padding: 0 20px 18px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.post-actions {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 14px; border-top: 1px solid var(--border);
}
.action-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 6px 12px; border-radius: 7px;
  font-size: 13px; color: var(--text3); cursor: pointer;
  transition: all .15s;
}
.action-btn:hover { background: var(--bg3); color: var(--text); }
.action-btn.liked { color: #f87171; }

/* Comments */
.comments-section {
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.comments-list { display: flex; flex-direction: column; gap: 0; }
.comment-item {
  display: flex; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.comment-body { flex: 1; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-text { font-size: 13px; color: var(--text2); }
.comment-time { font-size: 11px; color: var(--text3); }
.comment-input {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
}
.comment-input input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 7px 12px; border-radius: 20px;
  font-size: 13px; outline: none; transition: border .15s;
}
.comment-input input:focus { border-color: var(--accent); }
.empty-feed { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ── Quick links sidebar ─────────────────────────────────────── */
.quick-links-list { display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.quick-link-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--text2);
  transition: all .15s;
}
.quick-link-row:hover { background: var(--bg3); color: var(--text); }
.dept-name-big { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 20px; padding: 12px 16px 4px; }
.view-profile-link { display: block; font-size: 12px; color: var(--accent); padding: 0 16px 14px; }
.view-profile-link:hover { text-decoration: underline; }

/* ── Profile ─────────────────────────────────────────────────── */
.profile-layout { max-width: 760px; margin: 0 auto; padding: 20px; }
.profile-main { display: flex; flex-direction: column; gap: 16px; }
.profile-header-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.profile-cover { height: 120px; background: linear-gradient(135deg, #1a1f36, #2d1b69); }
.profile-header-body { display: flex; align-items: flex-start; gap: 20px; padding: 0 24px 24px; }
.profile-avatar-wrap { margin-top: -40px; }
.profile-avatar-big {
  width: 80px; height: 80px; border-radius: 50%;
  border: 3px solid var(--bg2);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 32px; font-weight: 800; color: #fff;
}
.profile-header-info { flex: 1; padding-top: 12px; }
.profile-name { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; }
.profile-meta-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.dept-badge-lg { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; background: rgba(88,101,242,0.2); color: #818cf8; }
.profile-location { font-size: 13px; color: var(--text3); }
.role-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: rgba(245,158,11,0.15); color: var(--yellow); text-transform: uppercase; letter-spacing: 1px; }
.role-badge-sm { font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.role-superadmin { background: rgba(239,68,68,0.15); color: #f87171; }
.role-admin { background: rgba(245,158,11,0.15); color: #fbbf24; }
.role-user { background: var(--bg3); color: var(--text3); }
.profile-email { font-size: 13px; color: var(--text3); margin-top: 6px; }
.profile-bio { font-size: 14px; color: var(--text2); margin-top: 8px; }
.profile-joined { font-size: 12px; color: var(--text3); margin-top: 6px; }
.section-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--text2); margin-top: 8px; }

/* ── Form pages ──────────────────────────────────────────────── */
.form-page { max-width: 520px; margin: 40px auto; padding: 20px; }
.form-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.form-card h2 { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; margin-bottom: 20px; }
.styled-form { display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Admin layout ────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.admin-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  padding: 24px 16px; display: flex; flex-direction: column;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.admin-title {
  font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 800;
  color: var(--text2); letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 20px; padding-left: 8px;
}
.admin-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.admin-nav-item {
  padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--text3); transition: all .15s;
}
.admin-nav-item:hover, .admin-nav-item.active {
  background: var(--bg3); color: var(--text);
}
.btn-back {
  font-size: 13px; color: var(--text3); padding: 8px 12px;
  border-radius: 8px; transition: all .15s; margin-top: 16px;
  display: block;
}
.btn-back:hover { color: var(--text); background: var(--bg3); }
.admin-content { flex: 1; padding: 28px; overflow-x: auto; }
.tab-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.tab-header h3 { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; }
.inline-form {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.inline-form h4 { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--text2); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-form.compact { grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form-full { grid-column: 1 / -1; }

/* Data table */
.data-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead { background: var(--bg3); }
.data-table th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.action-cell { display: flex; gap: 6px; }
.edit-row td { background: var(--bg3) !important; padding: 16px; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* Dept checkboxes */
.dept-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.checkbox-label {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--border); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s; color: var(--text2);
}
.checkbox-label:hover { border-color: var(--accent); color: var(--text); }
.checkbox-label input[type=checkbox] { accent-color: var(--accent); }

/* Links grid */
.links-grid { display: flex; flex-direction: column; gap: 12px; }
.link-admin-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.link-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.link-icon-lg { font-size: 24px; }
.link-card-title { font-weight: 700; font-size: 14px; }
.link-card-url { font-size: 12px; color: var(--text3); }
.link-perms { }
.perms-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

/* Dept cards */
.dept-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.dept-admin-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.dept-card-color { height: 6px; background: var(--dept-color); }
.dept-card-name { padding: 14px 16px; font-weight: 700; font-size: 14px; }

/* ── Responsive — full mobile support ───────────────────────── */

/* Tablet (≤1100px) */
@media (max-width: 1100px) {
  .home-layout { grid-template-columns: 240px 1fr; }
  .sidebar-right { display: none; }
  .policy-detail-page { grid-template-columns: 1fr; }
  .policy-detail-sidebar { order: -1; }
}

/* Mobile (≤768px) */
@media (max-width: 768px) {

  /* ── Topbar ── */
  .topbar { padding: 0 12px; gap: 8px; height: 54px; }
  .brand-name { display: none; }
  .topbar-links { display: none; }
  .topbar-search { display: none; }
  .user-info-sm { display: none; }
  .user-chip { padding: 4px; border: none; background: none; }
  .topbar-right { gap: 4px; }
  .icon-btn { width: 32px; height: 32px; }

  /* ── Home layout ── */
  .home-layout { grid-template-columns: 1fr; gap: 12px; }
  .sidebar-left { order: 2; }
  .feed-center { order: 1; }
  .sidebar-right { display: none; }
  .page-content { padding: 12px; }

  /* ── Post composer ── */
  .composer-bottom { flex-wrap: wrap; gap: 8px; }
  .dept-select { width: 100%; }
  .btn-post { width: 100%; }
  kbd { display: none; }

  /* ── Post card ── */
  .post-header { padding: 12px 12px 8px; }
  .post-content { padding: 0 12px 12px; font-size: 14px; }
  .post-actions { padding: 6px 8px; }

  /* ── Login ── */
  .login-page { flex-direction: column; height: auto; min-height: 100vh; }
  .login-left { display: none; }
  .login-right { padding: 32px 20px; }
  .login-form-wrap { max-width: 100%; }

  /* ── Profile ── */
  .profile-layout { padding: 12px; }
  .profile-header-body { flex-direction: column; align-items: flex-start; gap: 12px; padding: 0 16px 16px; }
  .profile-cover { height: 80px; }
  .profile-avatar-wrap { margin-top: -30px; }
  .profile-avatar-big { width: 64px; height: 64px; font-size: 24px; }
  .profile-name { font-size: 18px; }
  .profile-detail-actions { width: 100%; }

  /* ── Admin ── */
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%; height: auto; position: relative; top: 0;
    flex-direction: row; flex-wrap: wrap; padding: 10px;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .admin-title { display: none; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .admin-nav-item { padding: 6px 10px; font-size: 12px; }
  .btn-back { margin-top: 0; padding: 6px 10px; font-size: 12px; }
  .admin-content { padding: 16px; }
  .grid-form { grid-template-columns: 1fr; }
  .grid-form.compact { grid-template-columns: 1fr; }
  .tab-header { flex-wrap: wrap; gap: 8px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .action-cell { flex-wrap: wrap; }
  .links-grid { gap: 10px; }
  .dept-cards-grid { grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); }

  /* ── Messages page ── */
  .messages-layout { flex-direction: column; height: auto; min-height: calc(100vh - 54px); }
  .msg-sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .msg-convo-list { max-height: 200px; overflow-y: auto; }
  .msg-thread { height: calc(100vh - 310px); min-height: 300px; }
  .msg-bubbles { padding: 12px; }
  .msg-bubble { max-width: 80%; }
  .msg-compose { padding: 10px 12px; }
  .msg-thread-header { padding: 10px 14px; }

  /* ── People ── */
  .page-wide { padding: 12px; }
  .people-grid { grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 10px; }
  .people-grid.large { grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); }
  .person-card { padding: 14px 10px; }
  .person-avatar { width: 52px; height: 52px; font-size: 20px; }

  /* ── Search ── */
  .page-narrow { padding: 12px; }

  /* ── Notifications ── */
  .notif-item { padding: 10px 12px; }

  /* ── Policies ── */
  .policies-page { padding: 12px; }
  .policies-header { flex-direction: column; gap: 10px; }
  .policy-grid { grid-template-columns: 1fr; }
  .pf-row { grid-template-columns: 1fr; }
  .filter-form { flex-direction: column; align-items: stretch; }
  .filter-search { min-width: unset; }
  .policy-detail-page { padding: 12px; gap: 16px; }
  .policy-detail-title { font-size: 20px; }
  .policy-detail-info-row { flex-direction: column; gap: 4px; }
  .policy-detail-actions { flex-wrap: wrap; }
  .policy-stats { gap: 6px; }
  .stat-chip { font-size: 11px; padding: 4px 10px; }

  /* ── Floating chat widget ── */
  #chat-widget { bottom: 16px; right: 16px; }
  .chat-panel { width: calc(100vw - 32px); max-height: 70vh; }
  .chat-fab { width: 48px; height: 48px; }

  /* ── Announcements ── */
  .announcements-bar { padding: 6px 10px; gap: 5px; top: 50px; }
  .announcement-item { padding: 8px 10px; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
  .ann-body { flex-direction: column !important; align-items: flex-start !important; gap: 2px !important; overflow: visible !important; }
  .ann-body strong { white-space: normal !important; font-size: 13px; }
  .ann-content { white-space: normal !important; overflow: visible !important; text-overflow: unset !important; }
  .ann-sep { display: none; }
  .ann-meta { width: 100%; justify-content: flex-end; margin-top: 4px; }
  .ann-dept { display: inline-block !important; font-size: 10px; padding: 1px 6px; }
  .ann-time { font-size: 10px; }

  /* ── Forms ── */
  .form-page { padding: 12px; margin: 0; }
  .form-card { padding: 20px 16px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn-secondary,
  .form-actions .btn-primary { width: 100%; text-align: center; }

  /* ── Change password ── */
  .login-form-wrap { padding: 0; }

  /* ── Events sidebar (collapsed on mobile) ── */
  .widget-card { margin-bottom: 10px; }
  .event-item { padding: 8px; gap: 8px; }
  .evt-day { font-size: 16px; }

  /* ── Composer textarea ── */
  .composer-input-wrap textarea { min-height: 60px; font-size: 14px; }

  /* ── Post actions ── */
  .action-btn { padding: 5px 8px; font-size: 12px; }
}

/* Small phones (≤380px) */
@media (max-width: 380px) {
  .topbar { padding: 0 8px; gap: 4px; }
  .icon-btn { width: 30px; height: 30px; }
  .people-grid, .people-grid.large { grid-template-columns: 1fr 1fr; }
  .policy-grid { grid-template-columns: 1fr; }
  .chat-panel { width: calc(100vw - 20px); }
  #chat-widget { right: 10px; bottom: 10px; }
}

/* ── Topbar search ───────────────────────────────────────────── */
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  flex: 0 1 260px; transition: border .15s;
}
.topbar-search:focus-within { border-color: var(--accent); }
.topbar-search svg { color: var(--text3); flex-shrink: 0; }
.topbar-search input {
  background: none; border: none; color: var(--text);
  font-size: 13px; outline: none; width: 100%;
}
.topbar-search input::placeholder { color: var(--text3); }

/* ── Icon buttons (topbar) ───────────────────────────────────── */
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); border: 1px solid var(--border);
  transition: all .15s; position: relative; cursor: pointer;
  background: none;
}
.icon-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.badge-wrap { position: relative; }
.nav-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
  border: 2px solid var(--bg2);
}

/* ── Announcements bar ───────────────────────────────────────── */
.announcements-bar {
  padding: 8px 20px; display: flex; flex-direction: column; gap: 6px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  position: sticky; top: 54px; z-index: 90;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.announcement-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: rgba(88,101,242,0.07);
}
.announcement-item.priority-high { border-left-color: var(--yellow); background: rgba(245,158,11,0.07); }
.announcement-item.priority-urgent { border-left-color: var(--red); background: rgba(239,68,68,0.1); animation: pulse-border 2s infinite; }
@keyframes pulse-border { 0%,100%{opacity:1} 50%{opacity:.6} }
.ann-icon { font-size: 15px; flex-shrink: 0; }
.ann-body { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; }
.ann-body strong { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.ann-content { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ann-sep { color: var(--text3); flex-shrink: 0; }
.ann-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ann-dept { font-size: 11px; color: var(--accent); background: rgba(88,101,242,0.15); padding: 2px 8px; border-radius: 20px; }
.ann-time { font-size: 11px; color: var(--text3); white-space: nowrap; }

/* ── Pin ribbon ──────────────────────────────────────────────── */
.post-pinned { border-color: rgba(245,158,11,0.4) !important; }
.pin-ribbon {
  background: rgba(245,158,11,0.12); color: var(--yellow);
  font-size: 11px; font-weight: 600; padding: 5px 16px;
  border-bottom: 1px solid rgba(245,158,11,0.2);
}
.post-actions-header { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.action-btn-sm {
  background: none; border: none; font-size: 14px; cursor: pointer;
  padding: 4px 6px; border-radius: 5px; transition: background .15s;
  color: var(--text3);
}
.action-btn-sm:hover { background: var(--bg3); }

/* ── Notifications page ──────────────────────────────────────── */
.page-narrow { max-width: 680px; margin: 0 auto; padding: 24px 20px; }
.page-wide { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; }
.notif-list { display: flex; flex-direction: column; gap: 4px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2); transition: background .15s;
}
.notif-item:hover { background: var(--bg3); }
.notif-unread { border-color: var(--accent); background: rgba(88,101,242,0.07); }
.notif-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.notif-message { font-size: 14px; font-weight: 500; }
.notif-time { font-size: 12px; color: var(--text3); margin-top: 3px; }

/* ── Messages page ───────────────────────────────────────────── */
.messages-page { padding: 0 !important; }
.messages-layout { display: flex; height: calc(100vh - var(--topbar-h)); }
.msg-sidebar {
  width: 300px; flex-shrink: 0; border-right: 1px solid var(--border);
  background: var(--bg2); display: flex; flex-direction: column;
}
.msg-sidebar-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.msg-sidebar-header h3 { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; }
.msg-convo-list { flex: 1; overflow-y: auto; }
.msg-convo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  transition: background .15s; cursor: pointer;
}
.msg-convo-item:hover, .msg-convo-item.active { background: var(--bg3); }
.convo-info { flex: 1; min-width: 0; }
.convo-name { font-size: 14px; font-weight: 600; }
.convo-preview { font-size: 12px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-badge {
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 20px; flex-shrink: 0;
}
.msg-thread {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}
.msg-thread-header {
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2);
}
.thread-name { font-weight: 700; font-size: 15px; }
.thread-dept { font-size: 12px; color: var(--text3); }
.msg-bubbles {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg-bubble { max-width: 65%; display: flex; flex-direction: column; }
.bubble-mine { align-self: flex-end; align-items: flex-end; }
.bubble-theirs { align-self: flex-start; }
.bubble-text {
  padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5;
  word-break: break-word;
}
.bubble-mine .bubble-text { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble-theirs .bubble-text { background: var(--bg3); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble-time { font-size: 11px; color: var(--text3); margin-top: 3px; padding: 0 4px; }
.msg-compose {
  display: flex; gap: 10px; padding: 14px 20px;
  border-top: 1px solid var(--border); background: var(--bg2);
}
.msg-compose input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 10px 16px; border-radius: 24px;
  font-size: 14px; outline: none; transition: border .15s;
}
.msg-compose input:focus { border-color: var(--accent); }
.msg-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; color: var(--text3);
}

/* ── People directory ────────────────────────────────────────── */
.dept-filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.dept-tab {
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); color: var(--text2); transition: all .15s;
}
.dept-tab:hover { border-color: var(--border2); color: var(--text); }
.dept-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.people-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 14px;
}
.people-grid.large { grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); }
.person-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 16px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; transition: all .15s; cursor: pointer;
}
.person-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.person-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.person-avatar.avatar-img { object-fit: cover; }
.person-name { font-weight: 700; font-size: 14px; }
.person-meta { }
.person-loc { font-size: 12px; color: var(--text3); }
.person-msg-btn {
  margin-top: 4px; font-size: 12px; color: var(--accent);
  border: 1px solid var(--accent); padding: 5px 14px;
  border-radius: 20px; transition: all .15s;
  background: none; cursor: pointer; font-family: inherit;
  font-weight: 500;
}
.person-msg-btn:hover { background: var(--accent); color: #fff; }

/* ── Search page ─────────────────────────────────────────────── */
.search-section { margin-bottom: 28px; }
.search-section-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; color: var(--text2); margin-bottom: 12px; }

/* ── Avatar upload ───────────────────────────────────────────── */
.avatar-upload-wrap { display: flex; align-items: center; gap: 20px; margin-bottom: 8px; }
.avatar-preview {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--border2);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder {
  font-family: 'Syne', sans-serif; font-size: 30px; font-weight: 800;
  color: var(--accent);
}
.avatar-upload-info { display: flex; flex-direction: column; }
.avatar-img { object-fit: cover; }

/* ── kbd shortcut hint ───────────────────────────────────────── */
kbd {
  font-size: 10px; font-family: inherit; background: rgba(255,255,255,0.1);
  border-radius: 3px; padding: 1px 4px; margin-left: 4px; color: rgba(255,255,255,0.7);
}

/* ── Change password page ────────────────────────────────────── */
.change-pw-badge {
  display: inline-block; margin-bottom: 12px;
  background: rgba(88,101,242,0.15); color: #818cf8;
  border: 1px solid rgba(88,101,242,0.3);
  font-size: 12px; font-weight: 700; padding: 4px 12px;
  border-radius: 20px; letter-spacing: 0.5px;
}
.pw-input-wrap { position: relative; }
.pw-input-wrap input { padding-right: 40px; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 16px;
  color: var(--text3); padding: 2px;
}
.pw-strength-bar {
  height: 4px; background: var(--bg3); border-radius: 2px; margin-top: 8px; overflow: hidden;
}
.pw-strength-bar div {
  height: 100%; width: 0; border-radius: 2px;
  transition: width .3s, background .3s;
}
.pw-strength-label { font-size: 12px; margin-top: 4px; font-weight: 600; min-height: 16px; }
.pw-rules { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 16px; }
.pw-rule { font-size: 12px; color: var(--text3); transition: color .2s; }

/* ── Flash: password (green, prominent) ──────────────────────── */
.flash-password {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.4);
  color: #34d399;
  font-family: 'DM Sans', monospace;
  font-size: 14px; font-weight: 600;
  padding: 14px 18px;
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 10px;
}
.flash-password::before { content: '🔑'; font-size: 18px; }

/* ── Floating Chat Widget ────────────────────────────────────── */
#chat-widget {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}

/* FAB button */
.chat-fab {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 20px rgba(88,101,242,0.5);
  transition: transform .2s, box-shadow .2s; position: relative;
  flex-shrink: 0;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(88,101,242,0.65); }
.chat-fab:active { transform: scale(0.96); }
.chat-fab-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}

/* Panel */
.chat-panel {
  width: 320px;
  max-height: 480px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  flex-direction: column;
  animation: chat-pop .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes chat-pop {
  from { opacity:0; transform: scale(0.9) translateY(10px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}

/* Panel header */
.chat-panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg3); flex-shrink: 0;
}
.chat-panel-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14px; flex: 1; }
.chat-open-full {
  font-size: 16px; color: var(--text3); text-decoration: none;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: all .15s;
}
.chat-open-full:hover { background: var(--bg2); color: var(--text); }
.chat-close-btn {
  background: none; border: none; color: var(--text3); font-size: 16px;
  cursor: pointer; width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.chat-close-btn:hover { background: var(--bg2); color: var(--text); }

/* Search */
.chat-search-wrap { padding: 8px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-search-wrap input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 7px 11px; border-radius: 8px;
  font-size: 13px; outline: none; transition: border .15s;
}
.chat-search-wrap input:focus { border-color: var(--accent); }

/* List view */
#chat-view-list { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.chat-convo-list { flex: 1; overflow-y: auto; }
.chat-loading { padding: 20px; text-align: center; font-size: 13px; color: var(--text3); line-height: 1.6; }
.chat-convo-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  cursor: pointer; transition: background .15s; border-bottom: 1px solid var(--border);
}
.chat-convo-item:hover { background: var(--bg3); }
.chat-convo-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.chat-convo-info { flex: 1; min-width: 0; }
.chat-convo-name { font-size: 13px; font-weight: 600; }
.chat-convo-preview { font-size: 11px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-convo-badge {
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px; flex-shrink: 0;
}

/* Thread view */
#chat-view-thread { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.chat-back-btn {
  background: none; border: none; color: var(--text3); cursor: pointer;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; flex-shrink: 0; transition: all .15s;
}
.chat-back-btn:hover { background: var(--bg2); color: var(--text); }
.chat-thread-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.chat-thread-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.chat-thread-name { font-size: 13px; font-weight: 700; }
.chat-thread-dept { font-size: 11px; color: var(--text3); }
.chat-bubbles {
  flex: 1; overflow-y: auto; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.chat-bubble { max-width: 80%; display: flex; flex-direction: column; }
.chat-bubble-mine { align-self: flex-end; align-items: flex-end; }
.chat-bubble-theirs { align-self: flex-start; }
.chat-bubble-text {
  padding: 8px 12px; border-radius: 14px; font-size: 13px; line-height: 1.45;
  word-break: break-word;
}
.chat-bubble-mine .chat-bubble-text {
  background: var(--accent); color: #fff; border-bottom-right-radius: 4px;
}
.chat-bubble-theirs .chat-bubble-text {
  background: var(--bg3); border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-bubble-time { font-size: 10px; color: var(--text3); margin-top: 2px; padding: 0 4px; }
.chat-input-row {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input-row input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: 20px;
  font-size: 13px; outline: none; transition: border .15s;
}
.chat-input-row input:focus { border-color: var(--accent); }
.chat-send-btn {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .15s;
}
.chat-send-btn:hover { background: var(--accent-hover); transform: scale(1.08); }

/* ── Policies page ───────────────────────────────────────────── */
.policies-page { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.policies-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.policies-title {
  font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 800; margin-bottom: 4px;
}
.policies-subtitle { color: var(--text3); font-size: 14px; }

/* Add policy form */
.policy-form-card {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
}
.policy-form-card h3 { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.policy-form { display: flex; flex-direction: column; gap: 14px; }
.pf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Filters */
.policy-filters { margin-bottom: 16px; }
.filter-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px; flex: 1; min-width: 200px;
  transition: border .15s;
}
.filter-search:focus-within { border-color: var(--accent); }
.filter-search svg { color: var(--text3); flex-shrink: 0; }
.filter-search input { background: none; border: none; color: var(--text); font-size: 13px; outline: none; width: 100%; }
.filter-form select {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text2);
  padding: 7px 10px; border-radius: 8px; font-size: 13px; outline: none;
}

/* Stats bar */
.policy-stats { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-chip {
  padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
}
.stat-live { background: rgba(16,185,129,0.1); color: #34d399; border-color: rgba(16,185,129,0.25); }
.stat-upcoming { background: rgba(245,158,11,0.1); color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.stat-archived { background: rgba(100,116,139,0.1); color: #94a3b8; border-color: rgba(100,116,139,0.2); }

/* Policy grid */
.policy-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.policy-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column;
  gap: 10px; transition: all .2s; cursor: pointer;
}
.policy-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.3); }
.policy-card.status-upcoming { border-left: 3px solid var(--yellow); }
.policy-card.status-live { border-left: 3px solid var(--green); }
.policy-card.status-archived { border-left: 3px solid #475569; opacity: 0.8; }
.policy-card-top { display: flex; align-items: center; justify-content: space-between; }
.policy-status-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.status-badge-live { background: rgba(16,185,129,0.15); color: #34d399; }
.status-badge-upcoming { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-badge-archived { background: rgba(100,116,139,0.15); color: #94a3b8; }
.policy-category { font-size: 11px; color: var(--accent); background: rgba(88,101,242,0.12); padding: 3px 8px; border-radius: 20px; }
.policy-card-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; line-height: 1.3; }
.policy-card-summary { font-size: 13px; color: var(--text2); line-height: 1.5; flex: 1; }
.policy-card-footer {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 11px; color: var(--text3); border-top: 1px solid var(--border); padding-top: 10px;
}
.policy-has-file { color: var(--accent); }
.policy-date { margin-left: auto; }
.policy-meta { }

/* ── Policy detail page ──────────────────────────────────────── */
.policy-detail-page {
  display: grid; grid-template-columns: 1fr 280px;
  gap: 24px; max-width: 1100px; margin: 0 auto; padding: 24px 20px;
  align-items: start;
}
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text3); margin-bottom: 16px; }
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text3); }
.policy-detail-header { margin-bottom: 20px; }
.policy-detail-meta-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.policy-detail-title { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; margin-bottom: 10px; line-height: 1.2; }
.policy-detail-summary { font-size: 16px; color: var(--text2); margin-bottom: 14px; line-height: 1.6; }
.policy-detail-info-row { display: flex; gap: 20px; font-size: 13px; color: var(--text3); flex-wrap: wrap; margin-bottom: 16px; }
.policy-detail-actions { display: flex; gap: 8px; margin-top: 16px; }

/* Attachment banner */
.attachment-banner {
  display: flex; align-items: center; gap: 14px;
  background: rgba(88,101,242,0.08); border: 1px solid rgba(88,101,242,0.25);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px;
  text-decoration: none; transition: all .15s;
}
.attachment-banner:hover { background: rgba(88,101,242,0.14); border-color: var(--accent); }
.attach-icon { font-size: 28px; flex-shrink: 0; }
.attach-info { flex: 1; }
.attach-name { font-weight: 600; font-size: 14px; color: var(--text); }
.attach-hint { font-size: 12px; color: var(--text3); margin-top: 2px; }
.attach-dl { font-size: 13px; font-weight: 600; color: var(--accent); flex-shrink: 0; }

/* Policy content */
.policy-content-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.policy-content-body { font-size: 14px; line-height: 1.8; color: var(--text2); }
.policy-content-body br { display: block; margin-bottom: 4px; }

/* Related list */
.related-list { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.related-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 7px; font-size: 13px; color: var(--text2); transition: all .15s;
}
.related-item:hover { background: var(--bg3); color: var(--text); }
.related-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot-live { background: var(--green); }
.status-dot-upcoming { background: var(--yellow); }
.status-dot-archived { background: #475569; }
.related-title { flex: 1; }

/* Policy info list */
.policy-info-list { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.policy-info-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.pi-label { color: var(--text3); font-weight: 500; }
.pi-value { color: var(--text); font-weight: 600; text-align: right; }

/* Current attachment in edit form */
.current-attachment {
  display: flex; align-items: center; padding: 10px 14px;
  background: var(--bg3); border-radius: 8px; font-size: 13px;
  border: 1px solid var(--border);
}

@media (max-width: 900px) {
  .policy-detail-page { grid-template-columns: 1fr; }
  .policy-detail-sidebar { order: -1; }
  .pf-row { grid-template-columns: 1fr; }
}

/* ── Mobile bottom navigation ────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  justify-content: space-around; align-items: center;
}
.mob-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 8px; border-radius: 10px; text-decoration: none;
  color: var(--text3); font-size: 10px; font-weight: 500;
  transition: color .15s; position: relative; min-width: 52px;
}
.mob-nav-item svg { flex-shrink: 0; }
.mob-nav-item.mob-active { color: var(--accent); }
.mob-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.mob-badge {
  position: absolute; top: 0; right: 6px;
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; border: 2px solid var(--bg2);
}

/* Mobile search bar */
.mobile-search-bar {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}
.mobile-search-form {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px;
}
.mobile-search-form input {
  flex: 1; background: none; border: none; color: var(--text);
  font-size: 14px; outline: none;
}
.mobile-search-form svg { color: var(--text3); flex-shrink: 0; }

/* Desktop-only: hide on mobile */
.desktop-only { }
.mobile-search-btn { display: none; }

@media (max-width: 768px) {
  .mobile-bottom-nav { display: flex; }
  .desktop-only { display: none !important; }
  .mobile-search-btn { display: flex !important; }
  /* Add bottom padding so content isn't hidden behind nav */
  .page-content { padding-bottom: 80px; }
  .messages-page { padding-bottom: 0; }
  main.page-content { padding-bottom: 80px; }
  /* Hide floating chat widget on mobile (bottom nav replaces it) */
  #chat-widget { display: none; }
}

/* ── Light theme variables ───────────────────────────────────── */
[data-theme="light"] {
  --bg:     #d8dce3;
  --bg2:    #f0f2f6;
  --bg3:    #c8cdd6;
  --border: rgba(0,0,0,0.18);
  --border2: rgba(0,0,0,0.28);
  --text:   #1a1d23;
  --text2:  #4b5563;
  --text3:  #7a8394;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-glow: rgba(79,70,229,0.2);
  --green:  #059669;
  --red:    #dc2626;
  --yellow: #d97706;
  --shadow: 0 4px 24px rgba(0,0,0,0.14);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.10);
}

/* Light theme specific overrides */
[data-theme="light"] .topbar { background: #e8ebf0; border-bottom-color: rgba(0,0,0,0.18); box-shadow: 0 1px 4px rgba(0,0,0,0.10); }
[data-theme="light"] .post-card { background: #ffffff; border-color: rgba(0,0,0,0.14); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
[data-theme="light"] .post-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
[data-theme="light"] .widget-card { background: #ffffff; border-color: rgba(0,0,0,0.14); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
[data-theme="light"] .widget-header { border-bottom-color: rgba(0,0,0,0.10); }
[data-theme="light"] .post-composer { background: #ffffff; border-color: rgba(0,0,0,0.14); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
[data-theme="light"] .login-left { background: linear-gradient(145deg, #3730a3, #4f46e5); }
[data-theme="light"] .login-left .login-title,
[data-theme="light"] .login-left .login-subtitle { color: #fff; }
[data-theme="light"] .bubble-mine .bubble-text { background: var(--accent); color: #fff; }
[data-theme="light"] .bubble-theirs .bubble-text { background: var(--bg3); border-color: var(--border); color: var(--text); }
[data-theme="light"] .chat-bubble-mine .chat-bubble-text { background: var(--accent); color: #fff; }
[data-theme="light"] .chat-bubble-theirs .chat-bubble-text { background: var(--bg3); color: var(--text); }
[data-theme="light"] .msg-convo-item:hover,
[data-theme="light"] .msg-convo-item.active { background: var(--bg3); }
[data-theme="light"] .admin-sidebar { background: #ffffff; }
[data-theme="light"] .inline-form { background: var(--bg3); }
[data-theme="light"] .data-table thead { background: var(--bg3); }
[data-theme="light"] .data-table tr:hover td { background: rgba(0,0,0,0.02); }
[data-theme="light"] .policy-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.12); }
[data-theme="light"] .profile-cover { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); }
[data-theme="light"] .person-card { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .person-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
[data-theme="light"] .flash-success { background: rgba(5,150,105,0.1); border-color: rgba(5,150,105,0.3); color: #065f46; }
[data-theme="light"] .flash-error { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.2); color: #991b1b; }
[data-theme="light"] .flash-password { background: rgba(5,150,105,0.08); border-color: rgba(5,150,105,0.3); color: #065f46; }
[data-theme="light"] .dept-badge { background: rgba(79,70,229,0.1); color: #4338ca; border-color: rgba(79,70,229,0.2); }
[data-theme="light"] .mobile-bottom-nav { background: #ffffff; border-top-color: rgba(0,0,0,0.1); }
[data-theme="light"] .chat-panel { background: #ffffff; border-color: rgba(0,0,0,0.12); box-shadow: 0 12px 48px rgba(0,0,0,0.15); }
[data-theme="light"] .chat-panel-header { background: var(--bg3); }
[data-theme="light"] .notif-item { background: #ffffff; border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .notif-unread { background: rgba(79,70,229,0.06); border-color: rgba(79,70,229,0.2); }
[data-theme="light"] .event-item { background: var(--bg3); border: 1px solid rgba(0,0,0,0.08); }
[data-theme="light"] .pin-ribbon { background: rgba(217,119,6,0.1); }
[data-theme="light"] .edit-row td { background: var(--bg3) !important; }
[data-theme="light"] .link-admin-card { background: var(--bg3); }
[data-theme="light"] .dept-admin-card { background: var(--bg3); }
[data-theme="light"] .attachment-banner { background: rgba(79,70,229,0.06); }
[data-theme="light"] .policy-content-card { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
[data-theme="light"] .mobile-search-bar { background: #ffffff; }
[data-theme="light"] .mobile-search-form { background: var(--bg3); }
[data-theme="light"] .change-pw-badge { background: rgba(79,70,229,0.1); color: #4338ca; }
[data-theme="light"] .pw-strength-bar { background: var(--bg3); }
[data-theme="light"] input[type="file"] { color: var(--text2); }
[data-theme="light"] .current-attachment { background: var(--bg3); }
[data-theme="light"] .filter-search { background: #ffffff; }
[data-theme="light"] .filter-form select { background: #ffffff; }
[data-theme="light"] .topbar-search { background: var(--bg3); }
[data-theme="light"] .dept-select { background: var(--bg3); }
[data-theme="light"] .msg-compose { background: #ffffff; }
[data-theme="light"] .msg-thread-header { background: #ffffff; }
[data-theme="light"] .msg-sidebar-header { background: #f8f9fa; }

/* ── Theme toggle button ─────────────────────────────────────── */
.theme-toggle-btn {
  font-size: 16px; background: none; border: 1px solid var(--border);
  border-radius: 9px; width: 36px; height: 36px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.theme-toggle-btn:hover { background: var(--bg3); border-color: var(--border2); }

/* ── Mobile messages — fix keyboard hiding input ─────────────── */
@media (max-width: 768px) {
  /* Full screen messages layout */
  .messages-page { padding-bottom: 0 !important; }
  .messages-layout {
    position: fixed;
    top: 54px; /* topbar height */
    left: 0; right: 0;
    bottom: 60px; /* mobile nav height */
    flex-direction: row;
    overflow: hidden;
  }

  /* Sidebar: full width panel, hidden when thread is open */
  .msg-sidebar {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; flex-direction: column;
    border-right: none; border-bottom: none;
    z-index: 2;
  }
  .msg-convo-list { max-height: unset; flex: 1; overflow-y: auto; }

  /* Thread: full width panel */
  .msg-thread {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; display: flex; flex-direction: column;
    z-index: 3;
  }

  /* Back button: only visible on mobile */
  .msg-back-btn { display: flex; }

  /* Bubbles fill available space */
  .msg-bubbles {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    /* Let it shrink when keyboard opens */
    min-height: 0;
  }

  /* Compose bar: always pinned to bottom, above keyboard */
  .msg-compose {
    flex-shrink: 0;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    position: sticky;
    bottom: 0;
  }

  .msg-bubble { max-width: 85%; }
}

/* Desktop: hide mobile back button */
@media (min-width: 769px) {
  .msg-back-btn { display: none; }
  .msg-sidebar { display: flex !important; }
  .msg-thread { display: flex !important; }
}

/* ── Link preview in composer ────────────────────────────────── */
.composer-link-preview {
  margin: 0 16px 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border2);
  background: var(--bg3);
}
.preview-loading {
  padding: 12px 16px; font-size: 13px; color: var(--text3);
}
.composer-preview-inner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; position: relative;
}
.preview-img {
  width: 80px; height: 60px; object-fit: cover;
  border-radius: 6px; flex-shrink: 0;
}
.preview-embed-wrap {
  width: 100%; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden;
}
.preview-embed-wrap iframe { width: 100%; height: 100%; border: none; }
.preview-text { flex: 1; min-width: 0; }
.preview-domain { font-size: 11px; color: var(--text3); margin-bottom: 3px; }
.preview-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.preview-desc { font-size: 12px; color: var(--text2); margin-top: 3px; }
.preview-label { font-size: 13px; font-weight: 600; margin-top: 8px; color: var(--text); }
.preview-remove {
  position: absolute; top: 8px; right: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text3); border-radius: 50%; width: 22px; height: 22px;
  font-size: 12px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.preview-remove:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ── Post embed (video) ──────────────────────────────────────── */
.post-embed {
  width: 100%; aspect-ratio: 16/9;
  background: #000; overflow: hidden;
  margin: 0 0 0 0;
}
.post-embed iframe { width: 100%; height: 100%; border: none; display: block; }

/* ── Post link card ──────────────────────────────────────────── */
.post-link-card {
  display: flex; flex-direction: column;
  margin: 0; border-top: 1px solid var(--border);
  text-decoration: none; transition: background .15s;
  overflow: hidden;
}
.post-link-card:hover { background: var(--bg3); }
.post-link-image {
  width: 100%; max-height: 220px; object-fit: cover; display: block;
}
.post-link-info {
  padding: 12px 16px; display: flex; flex-direction: column; gap: 4px;
}
.post-link-domain { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.post-link-title { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; }
.post-link-desc { font-size: 12px; color: var(--text2); line-height: 1.5; }

/* Light theme overrides for link previews */
[data-theme="light"] .composer-link-preview { background: var(--bg3); }
[data-theme="light"] .preview-remove { background: var(--bg2); }
[data-theme="light"] .post-link-card:hover { background: var(--bg3); }

/* ── Settings tab ────────────────────────────────────────────── */
.settings-section { display: flex; flex-direction: column; gap: 16px; }
.settings-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.settings-card-title {
  font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700;
  margin-bottom: 12px;
}
.settings-preview {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
}
.settings-preview-label {
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px;
}
.settings-preview-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px;
}

/* ── Light mode extra border definition ─────────────────────── */
[data-theme="light"] .announcements-bar { border-bottom-color: rgba(0,0,0,0.15); }
[data-theme="light"] .announcement-item { border-left-width: 4px; }
[data-theme="light"] .policy-card { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .policy-card:hover { border-color: var(--accent); }
[data-theme="light"] .msg-sidebar { border-right-color: rgba(0,0,0,0.12); }
[data-theme="light"] .msg-thread-header { border-bottom-color: rgba(0,0,0,0.1); }
[data-theme="light"] .msg-convo-item { border-bottom-color: rgba(0,0,0,0.08); }
[data-theme="light"] .post-actions { border-top-color: rgba(0,0,0,0.08); }
[data-theme="light"] .comments-section { background: #f5f7fa; border-top-color: rgba(0,0,0,0.08); }
[data-theme="light"] .comment-item { border-bottom-color: rgba(0,0,0,0.07); }
[data-theme="light"] .admin-content { background: #f5f7fa; }
[data-theme="light"] .data-table-wrap { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .inline-form { border-color: rgba(0,0,0,0.1); }
[data-theme="light"] .policy-form-card { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .settings-card { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .dept-admin-card { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .link-admin-card { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea { border-color: rgba(0,0,0,0.18); background: #ffffff; }
[data-theme="light"] .topbar-search { border-color: rgba(0,0,0,0.15); background: #f5f7fa; }
[data-theme="light"] .dept-select { border-color: rgba(0,0,0,0.15); background: #f5f7fa; }
[data-theme="light"] .filter-form select { border-color: rgba(0,0,0,0.15); }
[data-theme="light"] .icon-btn { border-color: rgba(0,0,0,0.15); }
[data-theme="light"] .icon-btn:hover { background: #f0f2f5; border-color: rgba(0,0,0,0.22); }
[data-theme="light"] .user-chip { border-color: rgba(0,0,0,0.15); }
[data-theme="light"] .mobile-bottom-nav { border-top-color: rgba(0,0,0,0.15); box-shadow: 0 -2px 8px rgba(0,0,0,0.06); }

/* ── Copy link toast ─────────────────────────────────────────── */
.copy-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #1a1d23; color: #fff;
  padding: 10px 20px; border-radius: 24px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 9999; transition: opacity 0.4s;
  white-space: nowrap; pointer-events: none;
}
[data-theme="light"] .copy-toast { background: #1a1d23; color: #fff; }

/* ── Share button ────────────────────────────────────────────── */
.share-btn { color: var(--text3); transition: color .15s !important; }
.share-btn:hover { color: var(--accent) !important; }

/* ── Post media (image/video) ────────────────────────────────── */
.post-media { width: 100%; overflow: hidden; background: #000; }
.post-media-img {
  width: 100%; max-height: 500px; object-fit: contain;
  display: block; cursor: zoom-in; background: #000;
}
.post-media-vid {
  width: 100%; max-height: 500px; display: block; background: #000;
}

/* Composer media preview */
.composer-media-preview {
  margin: 0 16px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border2); overflow: hidden;
  position: relative; background: #000;
  display: flex; align-items: center; justify-content: center;
}
.composer-media-preview img,
.composer-media-preview video {
  max-height: 240px; max-width: 100%; object-fit: contain; display: block;
}
.media-remove-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.6); color: #fff;
  border: none; border-radius: 20px; padding: 4px 10px;
  font-size: 12px; cursor: pointer; transition: background .15s;
}
.media-remove-btn:hover { background: var(--red); }

/* Media upload button in composer */
.media-upload-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; border: 1px solid var(--border);
  background: var(--bg3); transition: all .15s; flex-shrink: 0;
}
.media-upload-btn:hover { border-color: var(--accent); background: var(--bg2); }

/* ── Lightbox ────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; cursor: zoom-out; padding: 20px;
}
.lightbox img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 4px; box-shadow: 0 8px 40px rgba(0,0,0,0.8);
}
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  color: #fff; font-size: 28px; cursor: pointer; opacity: 0.8;
  background: none; border: none; line-height: 1;
}
.lightbox-close:hover { opacity: 1; }

/* ── Post feed spacing ───────────────────────────────────────── */
#posts-feed { display: flex; flex-direction: column; gap: 24px; }
#posts-feed .post-card { margin-bottom: 0; }

/* ── New posts banner ────────────────────────────────────────── */
.new-posts-banner {
  background: var(--accent); color: #fff;
  padding: 10px 18px; border-radius: var(--radius);
  font-size: 13px; text-align: center; cursor: pointer;
  animation: slide-down .3s ease;
  transition: background .15s; margin-bottom: 8px;
}
.new-posts-banner:hover { background: var(--accent-hover); }
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Composer media buttons ──────────────────────────────────── */
.composer-media-btns { display: flex; align-items: center; gap: 4px; }
.media-upload-btn {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; border: 1px solid var(--border);
  background: var(--bg3); transition: all .15s; flex-shrink: 0;
}
.media-upload-btn:hover { border-color: var(--accent); background: var(--bg2); }

/* Hide camera buttons on desktop — they work everywhere but are most useful on mobile */
@media (min-width: 769px) {
  #post-camera-photo, #post-camera-video { display: none; }
  label[for="post-camera-photo"], label[for="post-camera-video"] { display: none; }
  .composer-media-btns label:nth-child(2),
  .composer-media-btns label:nth-child(3) { display: none; }
}

/* ── Profile extended fields ─────────────────────────────────── */
.pf-label { font-size: 12px; color: var(--text3); font-weight: 600; margin-right: 6px; }
.profile-reports-to { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.reports-to-link { color: var(--accent); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.reports-to-link:hover { text-decoration: underline; }
.profile-service { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; }
.service-value { font-weight: 600; color: var(--text); }
.service-since { font-size: 11px; color: var(--text3); font-weight: 400; margin-left: 4px; }
.profile-phone { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; }
.private-tag {
  font-size: 10px; padding: 2px 7px; border-radius: 10px;
  background: rgba(245,158,11,0.15); color: var(--yellow);
  border: 1px solid rgba(245,158,11,0.2); font-weight: 600;
}

/* Profile section cards */
.profile-section-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}
.profile-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 12px; border-bottom: 1px solid var(--border);
}
.profile-section-header h3 { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; }
.profile-section-body { padding: 16px 20px; font-size: 14px; color: var(--text2); line-height: 1.7; }
.contact-details-body { white-space: pre-wrap; }

/* Socials */
.profile-socials { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 20px; }
.social-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border2); font-size: 13px; font-weight: 500;
  color: var(--text2); transition: all .15s; text-decoration: none;
}
.social-link:hover { border-color: var(--accent); color: var(--accent); background: rgba(88,101,242,0.06); }
.social-icon {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--bg3); display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 800;
  flex-shrink: 0;
}

/* Edit profile section titles */
.edit-section-title {
  font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text3);
  padding: 16px 0 6px; border-top: 1px solid var(--border); margin-top: 8px;
}
.edit-section-title:first-of-type { border-top: none; margin-top: 0; padding-top: 8px; }
.hr-section-title { color: var(--yellow) !important; border-top-color: rgba(245,158,11,0.3) !important; }

[data-theme="light"] .profile-section-card { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .social-link { border-color: rgba(0,0,0,0.15); }

/* ── Admin role badge ────────────────────────────────────────── */
.admin-role-badge {
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 20px; background: rgba(245,158,11,0.15);
  color: var(--yellow); border: 1px solid rgba(245,158,11,0.25);
  text-align: center; margin-bottom: 12px;
}

/* ── Job Title ───────────────────────────────────────────────── */
.profile-job-title {
  font-size: 15px; color: var(--accent); font-weight: 600;
  margin-top: 2px; margin-bottom: 6px;
}
.person-job-title {
  font-size: 12px; color: var(--text3); margin: 2px 0 4px;
  font-style: italic;
}

/* ── Mini Calendar ───────────────────────────────────────────── */
.mini-calendar { padding: 8px 12px 4px; }
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.cal-month-label { font-weight: 700; font-size: 13px; }
.cal-nav-btn {
  background: none; border: 1px solid var(--border); color: var(--text2);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.cal-nav-btn:hover { background: var(--bg3); border-color: var(--accent); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; margin-bottom: 8px;
}
.cal-day-name {
  font-size: 10px; font-weight: 700; color: var(--text3);
  text-align: center; padding: 2px 0;
}
.cal-cell {
  aspect-ratio: 1; border-radius: 6px; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: all .12s; position: relative;
  color: var(--text2);
}
.cal-cell:hover:not(.cal-empty) { background: var(--bg3); color: var(--text); }
.cal-cell.cal-today { font-weight: 700; color: var(--accent); }
.cal-cell.cal-has-events { color: var(--text); }
.cal-cell.cal-selected { background: var(--accent); color: #fff !important; }
.cal-cell.cal-selected .cal-dot { background: rgba(255,255,255,0.7); }
.cal-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); position: absolute; bottom: 3px;
}
.cal-cell.cal-today .cal-dot { background: var(--accent); }
.cal-events-list {
  border-top: 1px solid var(--border); padding: 8px 0 4px;
  max-height: 200px; overflow-y: auto;
}
.cal-events-list .event-item { margin: 0 4px 6px; border-radius: 8px; }

/* ── @mention tag ────────────────────────────────────────────── */
.mention-tag {
  color: var(--accent); font-weight: 600;
  background: rgba(88,101,242,0.1); border-radius: 4px;
  padding: 0 3px; text-decoration: none;
}
.mention-tag:hover { background: rgba(88,101,242,0.2); text-decoration: none; }

/* ── Mention icon in notifications ───────────────────────────── */
.notif-icon { font-size: 18px; }

/* ── @mention autocomplete dropdown ─────────────────────────── */
.mention-dropdown {
  position: absolute; left: 0; bottom: calc(100% + 4px);
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 10px; box-shadow: var(--shadow);
  z-index: 500; min-width: 220px; overflow: hidden;
}
.mention-item {
  padding: 8px 14px; cursor: pointer; font-size: 13px;
  display: flex; gap: 8px; align-items: center;
  transition: background .1s;
}
.mention-item:hover { background: var(--bg3); }
.mention-item strong { color: var(--accent); }
.mention-item span { color: var(--text3); font-size: 12px; }
