@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Inter:wght@300;400;500;600&display=swap');

/* ============ DESIGN TOKENS ============ */
:root {
  --navy: #0B1F3A;
  --navy-light: #12335C;
  --green: #006B3F;
  --green-light: #0E8A55;
  --gold: #C8A45D;
  --gold-light: #E6CA89;
  --red: #C1272D;
  --ivory: #F7F9FC;
  --light: #EEF1F6;
  --text: #1a1a1a;
  --muted: #666;
  --border: #D8DEE8;
  --white: #ffffff;
  --amber: #b5790a;
  --amber-bg: #fbf0db;
  --shadow: 0 1px 3px rgba(0,107,63,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--ivory);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  color: var(--navy);
  font-weight: 700;
}

.serif { font-family: 'Playfair Display', serif; }

/* ============ LOGO ============ */
/* .logo-mark used to render "MD"+"N" as styled text; it now shows the official
   logo.jpeg artwork instead (which already includes the wordmark, the
   "Moroccan Diaspora Network" subtitle and the star), sized in em units so
   every existing inline font-size override still controls its size. The
   separate .logo-sub / .mdn-star elements are redundant with that artwork
   and hidden globally rather than edited out of every page. */
.mdn-logo {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.mdn-logo .logo-mark {
  display: inline-block;
  width: 4.6em;
  height: 1.85em;
  font-size: 26px;
  background-image: url('../img/logo.jpeg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center center;
  text-indent: -9999px;
  overflow: hidden;
  vertical-align: middle;
}
.logo-sub, .mdn-star { display: none; }

/* The artwork has an opaque background, so on dark green surfaces
   (sidebar, auth header, footer) give it a small plate to sit on. */
.mdn-logo.on-dark .logo-mark {
  background-color: #FAF6F3;
  border-radius: 5px;
  padding: 3px 6px;
  box-sizing: border-box;
}

/* ============ TOPBAR ============ */
.topbar {
  height: 68px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--ivory);
  font-size: 13.5px;
  color: var(--text);
}
.topbar-search input:focus { outline: none; border-color: var(--gold); background: var(--white); }
.topbar-search .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
}
.topbar-burger {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--navy);
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--light);
  color: var(--navy);
  font-size: 16px;
  border: none;
}
.topbar-icon-btn:hover { background: var(--gold-light); }
.badge-count {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 600;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid white;
}
.topbar-avatar-wrap { position: relative; }
.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  cursor: pointer;
}
.avatar-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 48px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 200px;
  overflow: hidden;
  z-index: 200;
}
.avatar-dropdown.open { display: block; }
.avatar-dropdown a, .avatar-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 18px;
  font-size: 13.5px;
  border: none;
  background: none;
  color: var(--text);
}
.avatar-dropdown a:hover, .avatar-dropdown button:hover { background: var(--light); }
.avatar-dropdown .divider { height: 1px; background: var(--border); margin: 4px 0; }
.avatar-dropdown .danger { color: var(--red); }

/* demo role switcher embedded in dropdown */
.demo-role-block { padding: 10px 18px; border-top: 1px solid var(--border); }
.demo-role-block .label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); font-weight: 600; margin-bottom: 6px; }

/* ============ APP LAYOUT ============ */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-body { padding: 24px 28px 60px; }

.app-body.layout-3col {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.app-body.layout-2col {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}
/* Without this, grid tracks size to their content's min-content (e.g. an
   unbroken conversation snippet or table row), which can make a "1fr" column
   render wider than a "1.8fr" one. Force tracks to respect the fr ratio. */
.app-body.layout-3col > *, .app-body.layout-2col > * { min-width: 0; }
.app-body.layout-single { max-width: 880px; margin: 0 auto; }
.app-body.layout-wide { max-width: 1100px; margin: 0 auto; }

/* ============ SIDEBAR ============ */
.sidebar {
  background: var(--navy);
  color: white;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo {
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user img {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  border: 1px solid rgba(255,255,255,0.3);
}
.sidebar-user .name { font-size: 13.5px; font-weight: 600; color: white; }
.sidebar-user .link { font-size: 11.5px; color: var(--gold-light); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 2px;
  position: relative;
}
.sidebar-nav a .ic { width: 18px; text-align: center; font-size: 15px; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.07); color: white; }
.sidebar-nav a.active {
  background: rgba(200,164,93,0.18);
  color: var(--gold-light);
  font-weight: 600;
}
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--gold);
  border-radius: 2px;
}
.sidebar-nav .nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--navy);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9px;
}
.sidebar-create {
  margin: 12px 16px 18px;
  padding: 12px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sidebar-create:hover { background: var(--gold-light); }

/* ============ CARDS ============ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.card + .card { margin-top: 18px; }
.card-pad { padding: 20px 22px; }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 16px; }
.card-header .see-all { font-size: 12.5px; color: var(--gold); font-weight: 600; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-light); }
.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--green); color: var(--green); }
.btn-ghost { background: transparent; color: var(--muted); border: none; }
.btn-ghost:hover { color: var(--green); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #9A1F24; }
.btn-danger-outline { background: transparent; color: var(--red); border-color: var(--red); }
.btn-danger-outline:hover { background: var(--red); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ BADGES / TAGS ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
}
.badge-gold { background: rgba(200,164,93,0.15); color: #98773E; }
.badge-green { background: rgba(0,107,63,0.1); color: var(--green); }
.badge-red { background: rgba(193,39,45,0.1); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-muted { background: var(--light); color: var(--muted); }
.badge-solid-gold { background: var(--gold); color: white; }

.tag-referent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--gold), #AB8746);
  color: white;
  padding: 3px 9px;
  border-radius: 5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--light);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 20px;
}
.chip button { border: none; background: none; color: var(--muted); font-size: 13px; line-height: 1; padding: 0; }

/* ============ AVATAR ============ */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 44px; height: 44px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 110px; height: 110px; border: 4px solid white; }

/* ============ FEED / POST ============ */
.composer { padding: 18px 20px; }
.composer-top { display: flex; gap: 12px; align-items: center; }
.composer-top input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 11px 18px;
  background: var(--ivory);
  font-size: 13.5px;
}
.composer-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--light);
  flex-wrap: wrap;
}
.composer-actions button {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 6px;
}
.composer-actions button:hover { background: var(--light); color: var(--green); }

.post { padding: 20px 22px; }
.post-head { display: flex; align-items: flex-start; gap: 12px; }
.post-head .meta { flex: 1; }
.post-head .name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.post-head .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.post-menu { color: var(--muted); background: none; border: none; font-size: 16px; padding: 4px 8px; }
.post-body { margin-top: 12px; font-size: 14px; color: #2a2a2a; }
.post-media { margin-top: 14px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.post-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--light);
}
.post-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}
.post-actions button {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 9px 0;
  border-radius: 6px;
}
.post-actions button:hover { background: var(--light); color: var(--green); }
.post-actions button.liked { color: var(--red); }

.comment-link { font-size: 13px; color: var(--muted); margin-top: 12px; cursor: pointer; }
.comment-link:hover { color: var(--green); }
.comment { display: flex; gap: 10px; margin-top: 14px; }
.comment-bubble { background: var(--light); border-radius: 14px; padding: 9px 14px; flex: 1; }
.comment-bubble .cname { font-weight: 600; font-size: 12.5px; }
.comment-bubble .ctext { font-size: 13px; margin-top: 2px; }
.comment-meta { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 4px; margin-left: 14px; }

.report-link {
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.report-link:hover { color: var(--red); }

/* ============ TABS ============ */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--border); }
.tabs a, .tabs button {
  background: none; border: none;
  padding: 14px 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a.active, .tabs button.active { color: var(--green); border-color: var(--gold); font-weight: 600; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.form-group .req { color: var(--red); }
.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=password],
.form-group input[type=date],
.form-group input[type=url],
.form-group input[type=number],
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13.5px;
  background: var(--white);
  color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,164,93,0.15);
}
.form-group .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
textarea { resize: vertical; min-height: 90px; }
.char-count { font-size: 11px; color: var(--muted); text-align: right; margin-top: 4px; }

.field-visibility {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  background: var(--light);
  border-radius: 14px;
  padding: 4px 10px;
  margin-left: 8px;
  border: 1px solid var(--border);
}

.radio-group, .check-group { display: flex; flex-direction: column; gap: 10px; }
.radio-row, .check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.radio-row input, .check-row input { accent-color: var(--green); width: 16px; height: 16px; }

.upload-box {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  background: var(--ivory);
}
.upload-box .ic { font-size: 26px; color: var(--gold); margin-bottom: 8px; }
.upload-box .label { font-size: 13px; font-weight: 600; color: var(--navy); }
.upload-box .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--light);
  border-radius: 8px;
  margin-top: 8px;
  font-size: 12.5px;
}
.file-row .fname { flex: 1; font-weight: 500; }
.file-row .fsize { color: var(--muted); }
.file-row button { background: none; border: none; color: var(--red); font-size: 14px; }

/* ============ MODAL ============ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,107,63,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: 12px;
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--muted); }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============ EMPTY / TOAST ============ */
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .ic { font-size: 36px; margin-bottom: 12px; }
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--navy); color: white;
  padding: 13px 20px; border-radius: 8px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 2000; display: none; align-items: center; gap: 10px;
}
.toast.show { display: flex; }

/* ============ DEMO ROLE SWITCH ============ */
.demo-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--light);
  border: 1px dashed var(--gold);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 18px;
  font-size: 12.5px;
}
.demo-bar .label { font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 0.5px; font-size: 10.5px; }
.demo-bar .opts { display: flex; gap: 6px; }
.demo-bar button {
  background: white; border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 12px; font-size: 12px; color: var(--muted); font-weight: 500;
}
.demo-bar button.active { background: var(--green); color: white; border-color: var(--green); }
/* [data-role-only] visibility is now controlled entirely by main.js (inline display),
   so a matched element's real CSS display (block/inline-flex/etc.) isn't clobbered. */

/* ============ PAGE HERO / HEADER BLOCKS ============ */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 24px; }
.page-head .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filters-bar select, .filters-bar input {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  font-size: 12.5px; background: white;
}
.filters-bar .search-box { position: relative; flex: 1; min-width: 200px; }
.filters-bar .search-box input { width: 100%; padding-left: 36px; }
.filters-bar .search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* generic entity card (project/event/opportunity/group) */
.entity-card { background: white; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.entity-card .thumb { height: 130px; background: var(--light); position: relative; }
.entity-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.entity-card .thumb .badge { position: absolute; top: 10px; left: 10px; }
.entity-card .body { padding: 16px 16px 18px; flex: 1; display: flex; flex-direction: column; }
.entity-card .body h4 { font-size: 15px; margin-bottom: 6px; }
.entity-card .body .meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.entity-card .body .desc { font-size: 12.5px; color: #444; margin: 8px 0; flex: 1; }
.entity-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.entity-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--light); }

/* ============ DETAIL HEADER (cover banner) ============ */
.cover-banner { height: 200px; border-radius: 10px; background: linear-gradient(120deg, var(--navy), var(--navy-light)); position: relative; overflow: hidden; }
.cover-banner img { width: 100%; height: 100%; object-fit: cover; }
.detail-id-row { display: flex; align-items: flex-end; gap: 18px; margin-top: -46px; padding: 0 24px; position: relative; z-index: 2; }
.detail-id-row .avatar-xl { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.detail-title-block { padding: 14px 24px 0; }
.detail-title-block h1 { font-size: 22px; }
.detail-title-block .meta-row { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.detail-actions { display: flex; gap: 10px; padding: 16px 24px 0; flex-wrap: wrap; }

/* ============ STAT CARD ============ */
.stat-card { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.stat-card .num { font-family: 'Playfair Display', serif; font-size: 30px; font-weight: 700; color: var(--navy); }
.stat-card .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card .delta { font-size: 11px; color: var(--green); margin-top: 6px; font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }

/* ============ TABLE ============ */
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border);
}
table.data-table td { padding: 13px 14px; font-size: 13px; border-bottom: 1px solid var(--light); vertical-align: middle; }
table.data-table tr:hover td { background: var(--ivory); }

/* ============ MESSAGING ============ */
.msg-layout { display: grid; grid-template-columns: 320px 1fr; grid-template-rows: minmax(0, 1fr); height: calc(100vh - 68px - 48px); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: white; }
.msg-list { min-height: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
.msg-list-search { padding: 14px; border-bottom: 1px solid var(--border); }
.msg-list-search input { width: 100%; padding: 9px 14px 9px 34px; border: 1px solid var(--border); border-radius: 20px; font-size: 12.5px; background: var(--ivory); }
.conv-item { display: flex; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--light); position: relative; }
.conv-item:hover, .conv-item.active { background: var(--light); }
.conv-item .meta { flex: 1; min-width: 0; }
.conv-item .top-row { display: flex; justify-content: space-between; align-items: center; }
.conv-item .top-row .name { font-weight: 600; font-size: 13.5px; }
.conv-item .top-row .time { font-size: 11px; color: var(--muted); }
.conv-item .snippet { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-item .unread-dot { background: var(--gold); color: white; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }

.msg-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.msg-thread-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.msg-thread-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--ivory); }
.bubble-row { display: flex; gap: 10px; max-width: 70%; }
.bubble-row.me { align-self: flex-end; flex-direction: row-reverse; }
.bubble { padding: 10px 15px; border-radius: 14px; font-size: 13.5px; background: white; border: 1px solid var(--border); }
.bubble p { margin: 0; }
.bubble p + p { margin-top: 8px; }
.bubble a { color: inherit; text-decoration: underline; }
.bubble-row.me .bubble { background: var(--navy); color: white; border: none; }
.bubble-time { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.msg-privacy-note { text-align: center; font-size: 11px; color: var(--muted); padding: 6px; }
.msg-thread-input { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px; border-top: 1px solid var(--border); }
.msg-thread-input-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.msg-thread-input-row input[type="text"] { flex: 1; border: 1px solid var(--border); border-radius: 22px; padding: 10px 16px; font-size: 13.5px; background: var(--ivory); }

/* [hidden] devrait suffire, mais le thème parent réinitialise l'affichage
   des <input> quelque part avec une spécificité/ordre qui gagne — on force
   donc explicitement, plutôt que de laisser le vrai input file du navigateur
   s'afficher à côté de notre bouton 📎. */
[data-mdn-attach-input] { display: none !important; }

.msg-attach-btn {
	display: flex; align-items: center; justify-content: center;
	width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; padding: 0 !important;
	padding-top: 5px !important;
	background: var(--ivory) !important; border: 1px solid var(--border) !important;
	color: var(--text) !important; cursor: pointer; font-size: 15px;
	box-shadow: none !important;
}
.msg-attach-btn:hover { background: var(--border) !important; }
.msg-attach-btn-modal { width: auto; height: auto; border-radius: 8px; padding: 8px 14px; gap: 6px; font-size: 12.5px; color: var(--navy) !important; }
.msg-attach-name { display: block; width: 100%; font-size: 11.5px; color: var(--muted); padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-attach-name:empty { display: none; }
.msg-attachment-img { display: block; margin-top: 6px; }
.msg-attachment-img img { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; }
.msg-attachment-doc { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 8px 10px; background: rgba(0, 0, 0, .05); border-radius: 8px; font-size: 12px; color: inherit; text-decoration: none; }
.bubble-row.me .msg-attachment-doc { background: rgba(255, 255, 255, .15); }

/* ---- Modal "Joindre un fichier" (choix type + glisser-déposer) ----
   Le thème parent définit `.buddypress .buddypress-wrap button { background:
   var(--bb-primary-button-background-regular); }` (spécificité 0,2,1) — plus
   fort qu'une simple classe (0,1,0). Comme cette modale s'affiche sur des
   écrans BuddyPress (fil de messages imbriqué dans .buddypress-wrap), tous
   ses <button> ont besoin de !important pour ne pas hériter le bleu natif. */
[data-mdn-modal-file-input] { display: none !important; }
.modal-attach { max-width: 380px; }
.attach-dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 40px 16px; text-align: center; font-size: 12.5px; color: var(--muted); transition: border-color .15s, background .15s; }
.attach-dropzone.drag-over { border-color: var(--navy); background: var(--ivory); }
.dropzone-icon { font-size: 32px; margin-bottom: 8px; }
.attach-dropzone p { margin: 0 0 8px; }
.link-btn { background: none !important; border: none !important; padding: 0; color: var(--navy) !important; font-weight: 600; text-decoration: underline; cursor: pointer; font-size: inherit; }
.dropzone-filename { font-size: 12px; font-weight: 600; color: var(--navy); word-break: break-all; }
.modal-close { background: none !important; border: none !important; box-shadow: none !important; color: var(--muted) !important; }

/* ============ PROGRESS BAR ============ */
.progress-bar { height: 6px; background: var(--light); border-radius: 4px; overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--gold); }

/* ============ FOOTER (public pages) ============ */
.site-footer { background: var(--navy); color: rgba(255,255,255,0.6); padding: 40px 28px 24px; margin-top: 60px; }
.site-footer .cols { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; }
.site-footer h5 { color: white; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; font-family: 'Inter'; }
.site-footer a { display: block; font-size: 13px; padding: 4px 0; color: rgba(255,255,255,0.65); }
.site-footer a:hover { color: var(--gold-light); }
.site-footer .bottom { max-width: 1100px; margin: 28px auto 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 11.5px; text-align: center; }

/* ============ KING / INSTITUTIONAL PLACEHOLDER ============ */
.institutional-visual {
  height: 320px; border-radius: 14px; overflow: hidden; position: relative;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 60%, var(--gold) 150%);
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.institutional-visual .zellige-pattern {
  position: absolute; inset: 0; opacity: 0.12;
  background-image: repeating-linear-gradient(45deg, white 0, white 1px, transparent 1px, transparent 16px),
                     repeating-linear-gradient(-45deg, white 0, white 1px, transparent 1px, transparent 16px);
}
.institutional-visual .content { position: relative; z-index: 2; color: white; padding: 20px; }
.institutional-visual .star-big { font-size: 38px; color: var(--gold-light); margin-bottom: 14px; }
.institutional-visual .placeholder-label {
  display: inline-block; margin-top: 14px; font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; background: rgba(0,0,0,0.25); padding: 6px 14px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.25);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1180px) {
  .app-body.layout-3col { grid-template-columns: 1.4fr 1fr; }
  .app-body.layout-3col > :nth-child(3) { display: none; }
}
@media (max-width: 980px) {
  .app-body.layout-2col { grid-template-columns: 1fr; }
  .app-body.layout-3col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -260px; top: 0; width: 248px; z-index: 500;
    transition: left 0.2s; box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  .sidebar.open { left: 0; }
  .topbar-burger { display: block; }
  .topbar-search { max-width: none; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .msg-layout { grid-template-columns: 1fr; height: auto; }
  .msg-list { max-height: 320px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .app-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .site-footer .cols { grid-template-columns: 1fr; }
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 400;
}
.sidebar-overlay.open { display: block; }

/* ============ ACCUEIL — PORTAIL PUBLIC ============
   Deliberately editorial/institutional rather than a SaaS-startup landing:
   a two-tier masthead, a single dark ceremonial hero (no card grids inside it),
   numbered dossier-style lists instead of repeated icon-circle cards, and a
   connecting-line timeline instead of boxed process steps. */

.home-utility-bar { background: var(--ivory); color: rgba(11,31,58,0.75); font-size: 11.5px; padding: 7px 24px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); }
.home-utility-bar .sep { margin: 0 8px; opacity: 0.5; }

.home-masthead { background: var(--ivory); border-bottom: 1px solid var(--border); padding: 14px 24px; position: sticky; top: 0; z-index: 100; }
.home-masthead-row { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 30px; }
.home-masthead .links { display: flex; gap: 26px; margin-right: auto; }
.home-masthead .links a { font-size: 13px; font-weight: 600; color: var(--text); padding-bottom: 3px; border-bottom: 2px solid transparent; }
.home-masthead .links a:hover, .home-masthead .links a.active { border-color: var(--gold); color: var(--green); }
.home-masthead .cta { display: flex; gap: 10px; }

.home-hero { position: relative; background: linear-gradient(135deg, #ffffff 0%, var(--ivory) 60%, #EAF3EF 100%); overflow: hidden; padding: 64px 24px 0; }
.home-hero .zellige-pattern { position: absolute; inset: 0; opacity: 0.07; }
.home-hero-inner { position: relative; z-index: 2; max-width: 1120px; margin: 0 auto; text-align: center; }
.home-hero .eyebrow-rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.home-hero .eyebrow-rule .line { width: 30px; height: 1.5px; background: var(--red); }
.home-hero .eyebrow-rule .star { color: var(--gold); font-size: 13px; }
.home-hero .eyebrow-text { color: var(--gold); font-size: 11.5px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.home-hero h1 { color: var(--navy); font-size: 42px; line-height: 1.18; max-width: 820px; margin: 0 auto; }
.home-hero .sub { color: var(--muted); font-size: 15px; max-width: 600px; margin: 20px auto 0; line-height: 1.7; }
.home-hero .cta-row { display: flex; gap: 14px; justify-content: center; margin-top: 30px; }
/* Hero a un fond vidéo sombre (voile noir) — le bouton secondaire doit rester
   en blanc pour être lisible par-dessus. */
.home-hero .cta-row .btn-outline { border-color: rgba(255,255,255,.55) !important; color: #ffffff !important; }

.home-data-strip { position: relative; z-index: 2; max-width: 880px; margin: 46px auto 0; display: flex; }
.home-data-strip .cell { flex: 1; text-align: center; padding: 22px 10px; border-left: 1px solid var(--border); }
.home-data-strip .cell:first-child { border-left: none; }
.home-data-strip .num { font-family: 'Playfair Display', serif; font-size: 30px; font-weight: 700; color: var(--navy); }
.home-data-strip .lbl { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.home-hero-visual { position: relative; z-index: 2; max-width: 760px; margin: 40px auto 0; }
.home-hero-visual .frame { background: var(--white); border: 1px solid var(--border); border-radius: 18px 18px 0 0; padding: 26px 26px 0; box-shadow: 0 8px 24px rgba(11,31,58,0.08); }
.home-hero-visual .placeholder-label { display: inline-block; margin-top: 10px; font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; background: rgba(0,0,0,0.25); color: rgba(255,255,255,0.8); padding: 5px 13px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.2); }
.home-hero-visual .king-slot { height: 220px; border-radius: 12px 12px 0 0; background: linear-gradient(160deg, var(--navy), var(--navy-light) 60%, var(--gold)); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.home-hero-visual .king-slot .star-big { font-size: 30px; color: var(--gold-light); margin-bottom: 10px; }

/* ----- Editorial statement (mission) ----- */
.home-statement { padding: 76px 24px 30px; max-width: 880px; margin: 0 auto; text-align: center; }
.home-statement .kicker { color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; font-size: 11.5px; }
.home-statement p.lead { font-family: 'Playfair Display', serif; font-size: 27px; line-height: 1.45; color: var(--navy); margin-top: 16px; }
.home-statement p.lead em { font-style: normal; color: var(--gold); }

.home-value-strip { max-width: 1000px; margin: 44px auto 0; padding: 0 24px; display: flex; flex-wrap: wrap; }
.home-value-item { flex: 1 1 220px; padding: 22px 22px; border-left: 1px solid var(--border); }
.home-value-item:first-child { border-left: none; }
.home-value-item .n { font-family: 'Playfair Display', serif; font-size: 13px; font-weight: 700; }
.home-value-item:nth-child(1) .n { color: var(--green); }
.home-value-item:nth-child(2) .n { color: var(--navy); }
.home-value-item:nth-child(3) .n { color: var(--red); }
.home-value-item:nth-child(4) .n { color: var(--gold); }
.home-value-item h3 { font-size: 15.5px; margin-top: 6px; }
.home-value-item p { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }

/* ----- Services as a numbered dossier list ----- */
.home-section { padding: 70px 24px; max-width: 1000px; margin: 0 auto; }
.home-section-head { max-width: 640px; }
.home-section .kicker { color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; font-size: 11.5px; }
.home-section h2 { font-size: 28px; margin-top: 10px; }
.home-section .lede { font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.7; }

.home-dossier { margin-top: 38px; border-top: 1px solid var(--border); }
.home-dossier-row { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 24px; padding: 26px 0; border-bottom: 1px solid var(--border); }
.home-dossier-row .num { font-family: 'Playfair Display', serif; font-size: 28px; }
.home-dossier-row:nth-child(1) .num { color: var(--green); }
.home-dossier-row:nth-child(2) .num { color: var(--navy); }
.home-dossier-row:nth-child(3) .num { color: var(--red); }
.home-dossier-row h3 { font-size: 17px; }
.home-dossier-row p { font-size: 13px; color: var(--muted); margin-top: 6px; max-width: 480px; line-height: 1.6; }
.home-dossier-row .go { font-size: 12px; font-weight: 700; color: var(--green); white-space: nowrap; }

/* ----- Réussites : asymmetric layout (no repeated identical cards) ----- */
.home-success-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 40px; margin-top: 36px; align-items: start; }
.home-stat-list { display: flex; flex-direction: column; gap: 22px; }
.home-stat-list .row { display: flex; align-items: baseline; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--light); }
.home-stat-list .num { font-family: 'Playfair Display', serif; font-size: 34px; font-weight: 700; min-width: 110px; }
.home-stat-list .row:nth-child(1) .num { color: var(--navy); }
.home-stat-list .row:nth-child(2) .num { color: var(--green); }
.home-stat-list .row:nth-child(3) .num { color: var(--red); }
.home-stat-list .row:nth-child(4) .num { color: var(--gold); }
.home-stat-list .lbl { font-size: 13px; color: var(--muted); }

.home-feature-card { border-radius: 18px; overflow: hidden; border: 1px solid var(--border); background: white; }
.home-feature-card .thumb { height: 200px; }
.home-feature-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.home-feature-card .body { padding: 22px; }
.home-feature-card h3 { font-size: 18px; }
.home-feature-card p { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.65; }

.home-mentions { margin-top: 18px; display: flex; flex-direction: column; gap: 0; }
.home-mention { display: flex; gap: 14px; padding: 16px 0; border-top: 1px solid var(--light); }
.home-mention .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.home-mention h4 { font-size: 13.5px; }
.home-mention p { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.55; }

/* ----- Fonctionnement : vertical connecting-line timeline ----- */
.home-timeline { margin-top: 40px; position: relative; padding-left: 50px; }
.home-timeline::before { content: ""; position: absolute; left: 17px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.home-timeline-item { position: relative; padding-bottom: 38px; }
.home-timeline-item:last-child { padding-bottom: 0; }
.home-timeline-item .node { position: absolute; left: -50px; top: 0; width: 36px; height: 36px; border-radius: 50%; color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13.5px; font-family: 'Playfair Display', serif; }
.home-timeline-item:nth-child(1) .node { background: var(--green); }
.home-timeline-item:nth-child(2) .node { background: var(--navy); }
.home-timeline-item:nth-child(3) .node { background: var(--red); }
.home-timeline-item h3 { font-size: 16px; }
.home-timeline-item p { font-size: 13px; color: var(--muted); margin-top: 6px; max-width: 520px; line-height: 1.65; }
.home-timeline-item .tag { display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 700; color: var(--gold); background: rgba(200,164,93,0.12); padding: 4px 10px; border-radius: 5px; }

/* ----- CTA : simple ceremonial band, no SaaS gradient/email-form ----- */
.home-cta-band { background: var(--ivory); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 64px 24px; text-align: center; }
.home-cta-band .star { font-size: 26px; color: var(--gold); }
.home-cta-band h2 { font-size: 26px; margin-top: 14px; max-width: 640px; margin-left: auto; margin-right: auto; }
.home-cta-band .cta-row { display: flex; gap: 14px; justify-content: center; margin-top: 24px; }

@media (max-width: 880px) {
  .home-masthead .links { display: none; }
  .home-hero h1 { font-size: 30px; }
  .home-data-strip { flex-wrap: wrap; }
  .home-data-strip .cell { flex: 1 1 33%; border-left: none; border-top: 1px solid rgba(255,255,255,0.16); }
  .home-success-grid { grid-template-columns: 1fr; }
  .home-dossier-row { grid-template-columns: 50px 1fr; }
  .home-dossier-row .go { grid-column: 2; }
  .home-value-item { flex: 1 1 45%; }
  .home-utility-bar { flex-direction: column; gap: 2px; }
}
/* Barre d'outils du composeur (Fil d'actualités, Messages) — icônes photo,
   GIF, sondage, document... */
#whats-new-formatting-toolbar .post-elements-buttons-item,
#whats-new-messages-toolbar .post-elements-buttons-item,
#whats-new-toolbar .post-elements-buttons-item {
  margin-top: 0;
}

@media (max-width: 560px) {
  .home-value-item { flex: 1 1 100%; border-left: none; border-top: 1px solid var(--border); padding-left: 0; }
  .home-value-item:first-child { border-top: none; }
}