/* ensure the soft hairline wins over any earlier rules */
.post-tools {
  border-top: 0 !important;
  box-shadow: 0 -1px 0 rgba(15, 23, 42, .10) !important;
}


:root {
  --primary: #0d6efd;
  --primary-dark: #0b5ed7;
  --page: #f6f7fb;
  /* Solid page background fixes the "column" */
  --card-bg: #ffffff;
  --radius: 16px;
  --transition: 0.25s ease;
}

/* Reset & base */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100svh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--page);
  display: grid;
  place-items: center;
  /* centers the card */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 36px;
  background: var(--card-bg);
  /* solid white, no frosted blur */
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  text-align: center;
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 24px;
}

/* ---------- Form ---------- */
.field {
  position: relative;
  margin-bottom: 14px;
}

.field input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover {
  color: var(--primary);
}

/* ---------- Button ---------- */

/* subtle secondary button (for Manage / Close) */
.btn-secondary {
  color: #0d6efd;
  background: #fff;
  border: 1px solid rgba(13, 110, 253, 0.35);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

.btn-secondary:hover {
  filter: none;
  background: #f8fbff;
}

/* low-emphasis ghost button */
.btn-ghost {
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: none;
}

.btn-ghost:hover {
  background: #f9fafb;
}


/* App-wide button */
.btn {
  width: 100%;
  padding: 12px 18px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  border: 1px solid rgba(13, 110, 253, 0.28);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(13, 110, 253, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.4) inset;
  transition: transform 120ms ease,
    box-shadow var(--transition),
    filter var(--transition);
}

.btn:hover,
.btn:focus-visible {
  filter: brightness(1.03);
  box-shadow: 0 10px 22px rgba(13, 110, 253, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 6px 14px rgba(13, 110, 253, 0.18);
}


/* ---------- Messages ---------- */
#message {
  margin-top: 14px;
  font-size: 0.93rem;
  font-weight: 500;
  min-height: 1.2em;
}

.error {
  color: #d52731;
}

.success {
  color: #269f53;
}

/* ---------- Logout button ---------- */
.logout-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.12);
  transition: background var(--transition);
}

.logout-btn:hover {
  background: var(--primary-dark);
}



/* -------- Social page -------- */
#app {
  /* Fill most of the window while staying responsive */
  width: min(1200px, 96vw);
  margin: 24px auto;
}

.composer {
  display: grid;
  gap: 12px;
  /* space between toolbar, editor, button */
  background: var(--card-bg);
  border: 1px solid #eef2f6;
  /* subtle outline */
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  padding: 12px;
  margin: 4px 0 20px;


}

/* Row with both buttons aligned right */
/* Row split: icons on the left, Post on the right */
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* left ↔ right */
  gap: 10px;
}

.actions-left,
.actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Teachers toggle (light pill) */
.toggle-group {
  position: relative;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #0f172a;
  font-weight: 600;
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform .08s ease;
}

.toggle-btn:hover {
  background: #f9fafb;
}

.toggle-btn:active {
  transform: translateY(1px);
}

.switch {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 9999px;
  background: #e5e7eb;
  transition: background var(--transition);
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(13, 110, 253, 0.5);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .18);
  transition: left .18s ease;
}

/* ON state (when checkbox is checked) */
.toggle-input:checked+.toggle-btn .switch {
  background: var(--primary);
}

.toggle-input:checked+.toggle-btn .switch-knob {
  left: 18px;
}

.toggle-input:checked+.toggle-btn .toggle-text {
  color: var(--primary);
}


/* Teachers slider group */
.slider-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

.slider-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}

/* Number pill */
.slider-value {
  min-width: 28px;
  padding: 2px 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0b5ed7;
  background: #eef6ff;
  border: 1px solid #d6e9ff;
  border-radius: 9999px;
  text-align: center;
}

/* Nice range styling */
.slider-group input[type="range"] {

  width: 160px;
  height: 6px;
  background: #e5e7eb;
  /* fallback, JS will paint fill */
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
}

/* WebKit thumb */
.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(13, 110, 253, 0.5);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .18);
  transition: transform .08s ease, box-shadow var(--transition);
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 6px rgba(16, 24, 40, .22);
}

.slider-group input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(0.96);
}

/* Firefox track & thumb */
.slider-group input[type="range"]::-moz-range-track {
  height: 6px;
  background: transparent;
  border: none;
}

.slider-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(13, 110, 253, 0.5);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .18);
}


/* Category select (light pill) */
.select-wrapper {
  position: relative;
}

.select-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #0f172a;
  /* slate-900 */
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  transition: background var(--transition), box-shadow var(--transition), transform .08s ease;
}

.select-btn:hover {
  background: #f9fafb;
}

.select-btn:active {
  transform: translateY(1px);
}

.select-caret {
  font-size: 12px;
  transition: transform var(--transition);
}

.select-btn[aria-expanded="true"] .select-caret {
  transform: rotate(180deg);
}

/* Dropdown panel */
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(16, 24, 40, 0.16);
  padding: 6px;
  z-index: 40;
  display: none;
}

.dropdown.open {
  display: block;
}

/* Dropdown items */
.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  color: #0f172a;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
}

.dropdown-item:hover {
  background: #f3f4f6;
}

.dropdown-item.active {
  background: #eef6ff;
  color: #0b5ed7;
}


/* Round icon button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #0f172a;
  /* slate-900 */
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  cursor: pointer;
  transition: transform .08s ease, box-shadow var(--transition), background var(--transition), color var(--transition);
}

/* Badge on the Message status icon */
.icon-btn {
  position: relative;
}

/* ensure the badge positions against the button */

.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  /* red */
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

.notif-badge[hidden] {
  display: none;
}


.icon-btn i {
  font-size: 16px;
  line-height: 1;
}

.icon-btn:hover {
  background: #f9fafb;
}

.icon-btn:active {
  transform: translateY(1px);
}



/* Formatting toolbar polish */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  margin-bottom: 2px;
  background: linear-gradient(180deg, #f6f7fb, #eff3f7);
  border: 1px solid #e6ebf2;
  border-radius: 14px;
  backdrop-filter: blur(4px);
}


.tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid #e5e7eb;
}

.tool-group:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

.tool-btn,
.color-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  transition: background var(--transition), transform 0.05s ease;
}

.tool-btn:hover,
.color-btn:hover {
  background: #f9fafb;
}

.tool-btn:active,
.color-btn:active {
  transform: translateY(1px);
}


.color-btn {
  font-size: 16px;
  line-height: 1;
}

.color-btn[aria-label="Red"] {
  color: #ef4444;
}

.color-btn[aria-label="Blue"] {
  color: #3b82f6;
}

.color-btn[aria-label="Magenta"] {
  color: #d946ef;
}

.color-btn[aria-label="Purple"] {
  color: #7c3aed;
}

.toolbar select {
  height: 34px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 8px;
  background: #fff;
}


/* Rich-text editor (contenteditable) */
.composer .editor {
  width: 100%;
  min-height: 160px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 12px;
  padding: 14px;
  font-size: 1rem;
  line-height: 1.6;
  outline: none;
}

.composer .editor:focus {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.composer .editor:empty:before {
  content: attr(data-placeholder);
  color: #6b7280;
  pointer-events: none;
}



.composer .editor:empty:before {
  content: attr(data-placeholder);
  color: #6b7280;
  pointer-events: none;
}

/* Works for both the contenteditable editor and your textarea */
.composer .editor,
.composer textarea {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.composer .editor:focus,
.composer textarea:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
  outline: none;
}



/* Composer-specific Post button */
/* Composer-specific Post button — slimmer & smaller */
.composer .btn {
  position: relative;
  width: auto;
  min-width: 90px;
  /* smaller */
  padding: 8px 14px;
  /* slimmer height/width */
  font-size: 0.95rem;
  /* slightly smaller text */
  align-self: end;
  justify-self: end;
  margin-top: 0;
  border-radius: 9999px;
  /* keep pill shape */
  border: 1px solid rgba(13, 110, 253, 0.35);
  /* crisp edge */
  box-shadow: 0 8px 18px rgba(13, 110, 253, 0.20),
    0 1px 0 rgba(255, 255, 255, 0.50) inset;
}


/* glossy highlight */
/* glossy highlight — subtler */
.composer .btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0));
  pointer-events: none;
}





.feed {
  list-style: none;
  padding: 0 0 32px;
  margin: 0;
}


.post {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  padding: 14px 16px;
  margin-bottom: 12px;
  word-wrap: break-word;

  /* smooth entry + hover polish */
  opacity: 1;
  transform: translateY(0);
  transition: opacity .25s ease, transform .25s ease, box-shadow .3s ease;
}

.post.enter {
  opacity: 0;
  transform: translateY(-6px);
}

.post:hover {
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.10);
  transform: translateY(-1px);
}


.post .meta {
  font-size: 0.82rem;
  color: #6b7280;
  margin-bottom: 6px;
}


/* Post content typography */
.post .content {
  font-size: 1rem;
  line-height: 1.6;
  color: #111827;
  margin-top: 8px;
  padding-top: 0;
  /* was 10px */
  border-top: 0;
  /* remove first divider */
}

.post .content a {
  color: var(--primary);
  text-decoration: underline;
}

.post .content a:hover {
  filter: brightness(0.9);
}

.post .content b,
.post .content strong {
  font-weight: 700;
}

.post .content i,
.post .content em {
  font-style: italic;
}

.post .content u {
  text-decoration: underline;
}


/* ---- Post card: improved header ---- */

.post .avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: #eef2ff;
  color: #1f2937;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12) inset;
}

/* Header: name on left, badges on top-right */
/* Header: keep layout, improve spacing/alignment */
.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  /* a touch more breathing room */
}

.post .title-block {
  display: block;
}

.post .name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: .2px;
}

.post .name .date {
  font-weight: 400;
  color: #6b7280;
  font-size: .9rem;
  margin-left: 6px;
}

/* Control bar (top-right): soft pill, even heights */
.badge-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  /* inner space around items */
  border: 1px solid #e6ebf2;
  border-radius: 9999px;
  background: linear-gradient(180deg, #fafbff, #f3f6fb);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

/* Make each child a neat, same-height chip */
.badge-group>.badge,
.badge-group>.cat-edit {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 9999px;
  font-weight: 700;
  border: 1px solid #e5e7eb;
  background: #fff;
}

/* Keep your existing coloring for these chips */
.badge-teachers {
  color: #0b5ed7;
  background: #eef6ff;
  border-color: rgba(13, 110, 253, .35);
}

.badge-category {
  color: #374151;
  background: #f3f4f6;
  border-color: #e5e7eb;
}

/* Flatten the tiny toggle so it fits the bar nicely */
.mini-toggle {
  padding: 0 6px;
  /* keep height short, no extra border */
  border: 0;
  background: transparent;
  box-shadow: none;
}

.mini-toggle-ui {
  width: 34px;
  height: 18px;
}

.mini-toggle-icon {
  font-size: .9rem;
  padding-left: 2px;
  opacity: .9;
}

.mini-toggle:hover .mini-toggle-icon {
  opacity: 1;
}



/* Card becomes a positioning context, with extra bottom room for the control bar */
.post {
  position: relative;
  padding-bottom: 64px;
}

/* Bottom-right CONTROL BAR (like the top-right group) */
.post-actions {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  /* inner padding for the bar */
  border: 1px solid #e6ebf2;
  border-radius: 9999px;
  background: linear-gradient(180deg, #fafbff, #f3f6fb);
  /* soft pill look */
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  opacity: .92;
  transition: opacity .2s ease;
}

.post:hover .post-actions {
  opacity: 1;
}


/* Bottom-left CONTROL BAR (mirrors right side) */
.post-actions-left {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid #e6ebf2;
  border-radius: 9999px;
  background: linear-gradient(180deg, #fafbff, #f3f6fb);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  opacity: .92;
  transition: opacity .2s ease;
}

.post:hover .post-actions-left {
  opacity: 1;
}

.post-actions-left .icon-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  color: #64748b;
  cursor: pointer;
  transition: background .2s, color .2s, transform .08s;
}

.post-actions-left .icon-btn i {
  font-size: 16px;
  line-height: 1;
}

.post-actions-left .icon-btn:hover {
  background: #fff;
  color: #0b5ed7;
}

.post-actions-left .icon-btn:active {
  transform: translateY(1px);
}


/* Icon-only trash inside the bottom-right bar */
.post-actions .trash-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  /* neutral */
  transition: color .2s ease, transform .08s ease;
}

.post-actions .trash-btn i {
  font-size: 18px;
}

.post-actions .trash-btn:hover {
  color: #ef4444;
}

.post-actions .trash-btn:active {
  transform: translateY(1px);
}

/* optional focus polish without a “ring” background */
.post-actions .trash-btn:focus-visible {
  outline: none;
  text-shadow: 0 0 0.5px currentColor;
}


/* Any icon buttons you place inside the bar (trash, edit, share...) */
.post-actions .icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 0;
  /* no inner border – bar already has one */
  background: transparent;
  color: #64748b;
  /* neutral by default */
  cursor: pointer;
  transition: background .2s, color .2s, transform .08s;
}

.post-actions .icon-btn i {
  font-size: 16px;
  line-height: 1;
}

/* Hover states for icon buttons */
.post-actions .icon-btn:hover {
  background: #fff;
  /* slight lift on hover */
  color: #ef4444;
  /* red for delete-like actions */
}

.post-actions .icon-btn:active {
  transform: translateY(1px);
}

.post-actions .icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 24, 40, .18);
}

/* Make your existing trash button adopt the new icon-btn style inside the bar */
.post-actions .trash-btn {
  all: unset;
}

.post-actions .trash-btn {
  /* reapply as an icon button */
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: #64748b;
  cursor: pointer;
  transition: background .2s, color .2s, transform .08s;
}

.post-actions .trash-btn:hover {
  background: #fff;
  color: #ef4444;
}

.post-actions .trash-btn:active {
  transform: translateY(1px);
}

.post-actions .trash-btn i {
  font-size: 16px;
  line-height: 1;
}






/* Small, rounded badges next to the date */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.badge-teachers {
  color: #0b5ed7;
  background: #eef6ff;
  border-color: rgba(13, 110, 253, .35);
}

.badge-category {
  color: #374151;
  background: #f3f4f6;
  border-color: #e5e7eb;
}



/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  z-index: 50;
}

.modal.open {
  display: grid;
  place-items: center;
}

.modal-dialog {
  width: min(900px, 96vw);
  /* wider */
  max-height: 84vh;
  /* cap height by viewport */
  overflow: hidden;
  /* keep rounded corners */
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
  padding: 18px 16px 16px;
  border: 1px solid #eef2f6;
}



/* Make DELETE confirmation popups small (override the wide default) */
#confirmModal .modal-dialog,
#confirmCommentModal .modal-dialog {
  width: min(420px, 92vw);
  max-height: none;
  overflow: visible;
}

/* Task picker modal size */
#taskModal .modal-dialog {
  width: min(520px, 92vw);
  max-height: none;
  overflow: visible;
}


/* Message-status confirmation should be small */
#statusConfirmModal .modal-dialog {
  width: min(480px, 92vw);
  max-height: none;
  overflow: visible;
}



/* ----- Message status modal styles ----- */
.status-body {
  margin: 10px 0 6px;
  padding: 8px;
  background: #f9fafb;
  border: 1px solid #eef2f6;
  border-radius: 12px;
  max-height: 60vh;
  /* dynamic, tied to viewport */
  overflow: auto;
}


.status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.status-item {
  display: grid;
  grid-template-columns: 1fr 260px;
  /* col1 = email, col2 = dropdown */
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
}


/* --- Search field + suggestions for Message status --- */
.search-wrap {
  position: relative;
}

.student-search {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
}

.sugg-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(16, 24, 40, .16);
  padding: 6px;
  z-index: 100;
}

.sugg-item {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  background: none;
  color: #0f172a;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.sugg-item:hover {
  background: #f3f4f6;
}


.student-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
}



.student-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
}


.status-email {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .95rem;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: .72rem;
  font-weight: 700;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  color: #374151;
}

.role-teacher {
  background: #eef6ff;
  border-color: rgba(13, 110, 253, .35);
  color: #0b5ed7;
}

.role-admin {
  background: #fff7ed;
  border-color: rgba(234, 88, 12, .35);
  color: #ea580c;
}

.role-sa {
  background: #ecfdf5;
  border-color: rgba(16, 185, 129, .35);
  color: #10b981;
}

.status-loading,
.status-empty {
  color: #6b7280;
  padding: 8px;
}


.modal-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}


/* Mini switch used in post header (top-right) */
.mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  cursor: pointer;
}

.mini-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.mini-toggle-ui {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 9999px;
  background: #e5e7eb;
  transition: background var(--transition);
}

.mini-toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(13, 110, 253, 0.5);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .18);
  transition: left .18s ease;
}

/* ON */
.mini-toggle-input:checked+.mini-toggle-ui {
  background: var(--primary);
}

.mini-toggle-input:checked+.mini-toggle-ui::after {
  left: 18px;
}

.mini-toggle-text {
  font-size: .8rem;
  font-weight: 700;
  color: #0f172a;
}


.mini-toggle-icon {
  font-size: .9rem;
  padding: 0 4px 0 2px;
  /* snug spacing beside the switch */
  color: #0b5ed7;
  /* same blue family */
  opacity: .9;
}

.mini-toggle:hover .mini-toggle-icon {
  opacity: 1;
}



.btn-danger {
  background: #ef4444;
  border: 1px solid rgba(239, 68, 68, .35);
}

.btn-danger:hover,
.btn-danger:focus-visible {
  filter: none;
  background: #dc2626;
}



/* Floating category picker */
.cat-pop {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(16, 24, 40, .16);
  padding: 6px;
}

.cat-pop-item {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  background: none;
  color: #0f172a;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.cat-pop-item:hover {
  background: #f3f4f6;
}

.cat-pop-item.active {
  background: #eef6ff;
  color: #0b5ed7;
}

/* Make the clickable category badge feel like a button */
.cat-edit {
  cursor: pointer;
}

.cat-edit:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .25);
}



.post-actions .icon-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  transition: color .2s, transform .08s;
}

.post-actions .icon-btn i {
  font-size: 18px;
}

.post-actions .icon-btn:hover {
  color: #0b5ed7;
}

/* blue hover for Edit */
.post-actions .trash-btn:hover {
  color: #ef4444;
}

/* red hover for Delete */


/* --- Section labels & divider between composer and feed --- */

/* Small overline label above the composer (you already have the HTML: .section-label) */
.section-label {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #475569;
  /* slate-600 */
  margin: 4px 2px 6px;
  opacity: .85;
}

/* Header row that holds "Create a post" and the logout icon */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 2px 10px;
  /* matches section-label spacing */
}

/* Tiny logout icon on the right */
.logout-icon {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  color: #64748b;
}

.logout-icon i {
  font-size: 14px;
}

.logout-icon:hover,
.logout-icon:focus-visible {
  color: #0b5ed7;
  background: #f3f4f6;
  outline: none;
}


/* Divider with a centered "Recent posts" pill */
.section-sep {
  position: relative;
  margin: 18px 0 14px;
  height: 24px;
}

.section-sep::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      #e6ebf2,
      #c7d2fe,
      /* soft indigo tint */
      #e6ebf2,
      transparent);
}

.section-sep .feed-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 9999px;
  color: #0f172a;
  font-weight: 800;
  font-size: .9rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}


/* Bottom-left single comment button */
.post-left-tools {
  position: absolute;
  left: 14px;
  bottom: 12px;
}

.post-left-tools .comment-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #64748b;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
  cursor: pointer;
  transition: background .2s, color .2s, transform .08s;
}

.post-left-tools .comment-btn:hover {
  background: #fff;
  color: var(--primary);
}

.post-left-tools .comment-btn:active {
  transform: translateY(1px);
}

.post-left-tools .comment-btn i {
  font-size: 16px;
  line-height: 1;
}

/* Comment textarea inside the modal */
.comment-textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  font-size: 1rem;
  background: #f9fafb;
}

.comment-textarea:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 110, 253, .12);
  outline: none;
}


/* ---------- Comments under a post ---------- */
.comments {
  display: none;
}

/* Smooth fade for comment updates */
.comments {
  transition: opacity 180ms ease; /* keep layout, just fade */
  will-change: opacity;
}
.comments.fade {
  opacity: 0; /* temporarily set to 0, then we remove it to fade to 1 */
}


/* hidden unless there are comments */
.comments.has-comments {
  display: block;
  margin-top: 12px;
  padding-top: 0;
  /* was 10px */
  border-top: 0;
  /* remove third divider */
}


.comments-title {
  font-weight: 800;
  font-size: .9rem;
  color: #475569;
  margin: 2px 2px 8px;
  opacity: .9;
}

.comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: flex-start;
}

.comment-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  background: #eef2ff;
  color: #1f2937;
  font-weight: 800;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12) inset;
}

.comment-body {
  background: #f9fafb;
  border: 1px solid #e6ebf2;
  border-radius: 14px;
  padding: 8px 10px;
}

.comment-header {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 2px;
}

.comment-author {
  font-weight: 800;
  color: #0f172a;
  font-size: .92rem;
}

.comment-dot {
  color: #94a3b8;
}

.comment-date {
  color: #6b7280;
  font-size: .78rem;
}

.comment-content {
  color: #111827;
  font-size: .95rem;
  line-height: 1.5;
}


/* ---------- Comments under a post ---------- */
.comments {
  display: none;
}

/* hidden unless there are comments */
.comments.has-comments {
  display: block;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f1f4f8;
}

.comments-title {
  font-weight: 800;
  font-size: .9rem;
  color: #475569;
  margin: 2px 2px 8px;
  opacity: .9;
}

.comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: flex-start;
}

.comment-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  background: #eef2ff;
  color: #1f2937;
  font-weight: 800;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12) inset;
}

.comment-body {
  background: #f9fafb;
  border: 1px solid #e6ebf2;
  border-radius: 14px;
  padding: 8px 10px;
}

.comment-header {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 2px;
}

.comment-author {
  font-weight: 800;
  color: #0f172a;
  font-size: .92rem;
}

.comment-dot {
  color: #94a3b8;
}

.comment-date {
  color: #6b7280;
  font-size: .78rem;
}

.comment-content {
  color: #111827;
  font-size: .95rem;
  line-height: 1.5;
}


/* ---------- Comments under a post ---------- */
.comments {
  display: none;
}

/* hidden unless there are comments */
.comments.has-comments {
  display: block;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f1f4f8;
}

.comments-title {
  font-weight: 800;
  font-size: .9rem;
  color: #475569;
  margin: 2px 2px 8px;
  opacity: .9;
}

.comments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: flex-start;
}

.comment-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  background: #eef2ff;
  color: #1f2937;
  font-weight: 800;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12) inset;
}

.comment-body {
  background: #f9fafb;
  border: 1px solid #e6ebf2;
  border-radius: 14px;
  padding: 8px 10px;
}

.comment-header {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 2px;
}

.comment-author {
  font-weight: 800;
  color: #0f172a;
  font-size: .92rem;
}

.comment-dot {
  color: #94a3b8;
}

.comment-date {
  color: #6b7280;
  font-size: .78rem;
}

.comment-content {
  color: #111827;
  font-size: .95rem;
  line-height: 1.5;
}


/* ===== Overrides: tools row & comments (compact, no avatar) ===== */

/* Make the controls sit IN FLOW under the content */
/* compact, clean toolbar under the post */
.post-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 0;
  background: transparent;
  border: 0;
  /* remove crisp line */
  box-shadow: 0 -1px 0 rgba(15, 23, 42, .10);
  /* soft hairline above */
}




/* Neutralize the old absolute positioning for these groups */
.post-actions,
.post-actions-left {
  position: static !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 1 !important;
}

/* The card no longer needs extra bottom padding for floating bars */
.post {
  padding-bottom: 16px !important;
}

/* Tidy icon buttons inside the tools bar */
.post-tools .icon-btn {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #64748b;
}

.post-tools .icon-btn i {
  font-size: 14px;
}

.post-tools .icon-btn:hover {
  background: #f8fafc;
  color: #0b5ed7;
}

.post-tools .trash-btn:hover {
  color: #ef4444;
}

.post-tools .icon-btn:hover {
  background: #fff;
  color: #0b5ed7;
}

.post-tools .trash-btn:hover {
  color: #ef4444;
}

/* Comments: remove the round initials circle and use a single-column bubble */
.comment-avatar {
  display: none !important;
}

.comment {
  display: block !important;
}

/* keep both sides tight */
.post-tools .post-actions,
.post-tools .post-actions-left {
  gap: 6px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* optionally show a labeled comment pill on the left */
.post-tools .comment-btn {
  width: auto;
  height: 28px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e6ebf2;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
}

.post-tools .comment-btn i {
  font-size: 14px;
}

.comment-body {
  background: #f9fafb;
  border: 1px solid #e6ebf2;
  border-radius: 12px;
  padding: 8px 10px;
}


/* ===== Nested replies & inline reply form ===== */
.comment-footer {
  display: flex;
  justify-content: space-between;
  /* Reply on the left, owner icons on the right */
  align-items: center;
  margin-top: 6px;
}

.comment-owner-actions {
  display: inline-flex;
  gap: 8px;
}

.comment-owner-actions .icon-btn {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #64748b;
}

.comment-owner-actions .icon-btn:hover {
  background: #fff;
  color: #0b5ed7;
  /* blue hover for edit */
}

.comment-owner-actions .cmt-del-btn:hover {
  color: #ef4444;
  /* red hover for delete */
}

/* Always show right-side actions; + Task is visible for everyone.
   Edit/Delete still only appear when present in the DOM. */
.comment-owner-actions {
  display: inline-flex;
  gap: 8px;
  margin-left: 8px;
}


/* Smooth in the icons for the hovered body */
.comment>.comment-body>.comment-footer>.comment-owner-actions .icon-btn {
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .15s ease, transform .15s ease;
}

.comment>.comment-body:hover>.comment-footer>.comment-owner-actions .icon-btn,
.comment>.comment-body:focus-within>.comment-footer>.comment-owner-actions .icon-btn {
  opacity: 1;
  transform: none;
}

/* NEW: make the "+ Task" button behave like the icons on comments */
.comment>.comment-body>.comment-footer>.comment-owner-actions .cmt-task-btn {
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .15s ease, transform .15s ease;
}

.comment>.comment-body:hover>.comment-footer>.comment-owner-actions .cmt-task-btn,
.comment>.comment-body:focus-within>.comment-footer>.comment-owner-actions .cmt-task-btn {
  opacity: 1;
  transform: none;
}


.reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  font-weight: 700;
  color: #64748b;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 9999px;
  transition: background .2s, color .2s;
}

.reply-btn:hover {
  background: #fff;
  color: var(--primary);
}

.reply-form {
  margin-top: 8px;
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 10px;
  padding: 8px;
}

.reply-form .reply-text {
  width: 100%;
  min-height: 60px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  padding: 8px;
  font-size: .95rem;
  background: #f9fafb;
}

.reply-form .reply-text:focus {
  background: #fff;
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
}

.reply-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}

.reply-actions .reply-save-btn,
.reply-actions .reply-cancel-btn {
  padding: 6px 10px;
  border-radius: 9999px;
  border: 1px solid #e6ebf2;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
}

.reply-actions .reply-save-btn {
  border-color: rgba(13, 110, 253, .35);
  color: #0b5ed7;
}

.reply-actions .reply-save-btn:hover {
  background: #eef6ff;
}

.reply-actions .reply-cancel-btn:hover {
  background: #f3f4f6;
}

.replies {
  margin-left: 14px;
  /* indent */
  padding-left: 10px;
  border-left: 2px solid #eef2f6;
  /* thread rail */
  margin-top: 6px;
}



/* keep user line breaks in comment text (top-level + replies) */
.comment-content {
  white-space: pre-wrap !important;
  /* preserve \n; still wraps long lines */
  word-break: break-word;
  /* avoid overflow on long words/urls */
}


/* ensure only a single divider remains */
.post .content,
.comments.has-comments {
  border-top: 0 !important;
  padding-top: 0 !important;
}


/* Small "Comment" pill on the left */
.comment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 9999px;
  border: 1px solid #e6ebf2;
  background: #fff;
  color: #64748b;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.comment-pill i {
  font-size: 14px;
  line-height: 1;
}

.comment-pill:hover {
  background: #f9fafb;
  color: var(--primary);
}


.comment-del {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  font-weight: 700;
  color: #9ca3af;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 9999px;
  transition: background .2s, color .2s;
}

.comment-del:hover {
  background: #fff;
  color: #ef4444;
}


/* Force ghost appearance even when .btn is also present */
.btn.btn-ghost {
  color: #374151 !important;
  background: #fff !important;
  background-image: none !important;
  /* kill gradient from .btn */
  border: 1px solid #e5e7eb !important;
  box-shadow: none !important;
  transform: none !important;
}

.btn.btn-ghost:hover {
  background: #f9fafb !important;
}

/* Reusable “+ Task” pill */
.task-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 9999px;
  border: 1px solid #e6ebf2;
  background: #fff;
  color: #0b5ed7;
  /* same blue family you use */
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, color .2s, transform .08s;
}

.task-btn i {
  font-size: 14px;
  line-height: 1;
}

.task-btn:hover {
  background: #eef6ff;
}

.task-btn:active {
  transform: translateY(1px);
}


/* --- Teacher multi-select list --- */
.teacher-list {
  max-height: 320px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid #eef2f6;
  border-radius: 12px;
  background: #f9fafb;
}

.teacher-item {
  position: relative;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.teacher-item:hover {
  background: #f3f4f6;
}

.teacher-item.selected {
  background: #eef6ff;
  border-color: rgba(13, 110, 253, .35);
  color: #0b5ed7;
}

.teacher-item.selected::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  font-weight: 800;
}

.chosen-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
  color: #0f172a;
  font-size: .9rem;
}


.teacher-list {
  display: grid;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
}

.teacher-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.teacher-item.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

.teacher-item .icon {
  opacity: .6;
}

.chosen-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chip {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 4px 8px;
}


/* --- Top tasks bar --- */
.tasks-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 6px;
  padding: 6px 8px;
  border: 1px dashed #f59e0b;
  background: #fff7ed;
  border-radius: 12px;
}

.task-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 9999px;
  background: #ffedd5;
  color: #9a3412;
  font-weight: 600;
  border: 1px solid #fdba74;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  position: relative;      /* NEW: needed for absolute button */
  white-space: nowrap;     /* NEW: prevents inner wrapping */
}


.task-chip .meta {
  font-size: .75rem;
  opacity: .8
}

.task-chip .complete {
  position: absolute;      /* NEW: take out of the layout flow */
  right: 6px;              /* NEW: pin to the right edge of the chip */
  top: 50%;                /* NEW: vertically center */
  transform: translateY(-50%);
  padding: 2px 8px;
  border-radius: 8px;
  background: #10b981;
  color: #fff;
  border: 0;
  opacity: 0;              /* NEW: hidden but does not change width */
  pointer-events: none;    /* NEW: not clickable until visible */
  transition: opacity .15s ease;
}

.task-chip:hover .complete {
  opacity: 1;              /* NEW: fade in on hover */
  pointer-events: auto;    /* NEW: becomes clickable */
}


.tasks-empty {
  font-style: italic;
  color: #6b7280
}

.tasks-bar .countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.task-chip.expired {
  background: #fee2e2;
  color: #991b1b;
}


/* Tighten gap between tasks bar and the section/composer that follows */
#tasksBar {
  margin-bottom: 6px !important;
  padding-bottom: 6px !important;
}

.tasks-bar+.section-label,
.tasks-bar+.section-header,
.tasks-bar+.composer {
  margin-top: 4px !important;
}


/* Smaller dialog variant for the countdown picker */
.modal .modal-dialog.modal-sm {
  width: 420px;
  max-width: calc(100vw - 24px);
}

/* Layout for the HH:MM inputs */
.time-grid {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 12px 0 8px;
}

.time-field {
  display: flex;
  flex-direction: column;
}

.time-label {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 4px;
}

.time-colon {
  font-size: 24px;
  line-height: 1;
  color: #6b7280;
  padding: 0 4px 6px 4px;
}

/* Inputs */
.time-field input {
  width: 110px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
}

.time-field input:focus {
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

/* Helper text */
.time-hint {
  margin: 0 0 12px;
  color: #6b7280;
  font-size: 12px;
}

/* ---- Busy overlay ---- */
#busyOverlay[hidden] { display: none !important; }
#busyOverlay {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(17, 24, 39, .45);
}
.busy-box {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 18px; background: #fff; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25); border: 1px solid #eef2f6;
}
.busy-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid #e5e7eb; border-top-color: var(--primary, #0d6efd);
  animation: busy-spin 1s linear infinite;
}
.busy-text { font-weight: 700; color: #0f172a; }
@keyframes busy-spin { to { transform: rotate(360deg); } }



/* Make the task-done confirm modal small */
#taskDoneModal .modal-dialog {
  width: min(480px, 92vw);
  max-height: none;
  overflow: visible;
}

/* Busy overlay */
#busyOverlay {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.45);
  display: grid;
  place-items: center;
  z-index: 9999;
}
#busyOverlay[hidden] { display: none; }

#busyOverlay .busy-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #eef2f6;
}
#busyOverlay .busy-spin {
  width: 18px; height: 18px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: busy-rot 1s linear infinite;
}
@keyframes busy-rot { to { transform: rotate(360deg); } }


/* --- Task filter banner --- */
.task-filter-banner{
  position: sticky; top: 0;
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px;
  background: #fffbe6; border: 1px solid #f0c36d; border-radius: 8px;
  margin: 10px 0 14px;
  z-index: 5;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.btn-clear-filter{
  padding: 6px 10px; border-radius: 6px; border: 1px solid #ddd; cursor: pointer;
  background: white; font-weight: 600;
}
.btn-clear-filter:hover{ background:#fafafa; }

/* --- Flash highlight for focused post/comment --- */
@keyframes flashFade {
  0%{ box-shadow: 0 0 0 4px rgba(255,215,0,.8); }
  100%{ box-shadow: 0 0 0 0 rgba(255,215,0,0); }
}
.flash-highlight{
  animation: flashFade 1.4s ease-out 1;
  border-radius: 8px;
}


/* Make the whole task chip feel clickable, keep Done from shrinking text */
.tasks-bar .task-chip { cursor: pointer; }
.tasks-bar .task-chip .complete { flex-shrink: 0; }


.badge.clear-filter-badge {
  cursor: pointer;
  background: #eef2ff;
  color: #4f46e5;
  border-color: rgba(79,70,229,.35);
}
.badge.clear-filter-badge:hover { filter: brightness(.96); }

/* --- Pagination --- */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 28px;
}

.pager .page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16,24,40,.06);
}

.pager .page-btn:hover {
  background: #f8fafc;
  color: var(--primary);
}

.pager .page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: rgba(13,110,253,.35);
}

.pager .page-jump {
  width: 72px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
}

.pager .page-go {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(13,110,253,.35);
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.pager .page-btn[disabled] { opacity: .5; cursor: not-allowed; }

.pager .page-ellipsis {
  min-width: 28px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  user-select: none;
}


/* —— Filters panel —— */
.filters-panel {
  margin: 14px 0 10px;
}
.filters-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16,24,40,.08);
  padding: 14px;
}
.filters-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 0.92rem;
  color: #374151;
  min-width: 120px;
}
.filter-input {
  width: 280px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
}
.filter-input:focus { border-color: var(--primary); }
.filters-clear {
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}
.filters-clear:hover { filter: brightness(.95); }

/* suggestions popover (re-usable) */
.search-wrap { position: relative; }
.sugg-pop {
  position: absolute;
  top: 38px;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(16,24,40,.12);
  z-index: 40;
  overflow: hidden;
}
.sugg-pop .sugg-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.sugg-pop .sugg-item:hover { background: #f3f4f6; }

.filter-chips { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2ff;
  color: #1f2937;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .9rem;
}
.filter-chips .chip .x {
  cursor: pointer;
  font-weight: 700;
}

/* --- limit width of email-filter suggestion drop-down --- */
.search-wrap{
  position: relative;        /* anchor the pop-up */
  display: inline-block;     /* wrapper only as wide as its input */
}

.search-wrap .sugg-pop{
  width: 100%;               /* exactly as wide as the wrapper/input */
  max-width: 100%;
  box-sizing: border-box;    /* include padding in that width */
}


/* --- CDN image thumbnails --- */
.cdn-wrap { display:block; margin:10px 0; }
.cdn-thumb {
  max-width:100%; height:auto; border-radius:12px;
  box-shadow:0 6px 24px rgba(0,0,0,.12);
  cursor: zoom-in;
}

/* --- Simple image viewer (lightbox) --- */
.imgv { display:none; position:fixed; inset:0; z-index:1000;
  background: rgba(15,23,42,.6); place-items:center; }
.imgv.open { display:grid; }
.imgv-img { max-width:92vw; max-height:86vh; border-radius:14px; box-shadow:0 20px 60px rgba(0,0,0,.35); }
.imgv-close {
  position:absolute; top:14px; right:14px; border:0; border-radius:10px;
  padding:8px 12px; font-size:20px; cursor:pointer; color:#fff; background:rgba(0,0,0,.35);
}


/* Prevent background scroll while a modal/lightbox is open */
html.no-scroll, body.no-scroll { overflow: hidden; }

/* Lightbox controls */
.imgv-controls{
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 8px;
}

.imgv-zoom{
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 18px;
  cursor: pointer;
  color: #fff;
  background: rgba(0,0,0,.35);
}

.imgv-zoom:active { transform: translateY(1px); }

/* Smooth zooming + proper anchor */
.imgv-img{
  transform-origin: center center;
  transition: transform .12s ease-out;
}


/* Quick Message popup (opened by the message icon) */
#msgModal .modal-dialog {
  width: min(520px, 92vw);
  max-height: none;
  overflow: visible;
  padding: 18px;
}

#msgModal .modal-actions{
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

#msgModal #msgSendBtn i { margin-right: 6px; }
#msgModal #msgSugg { margin-top: 8px; border-radius: 10px; }
#msgModal #msgSugg .sugg-item { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; }
#msgModal #msgSugg .sugg-item:last-child { border-bottom: none; }


#msgModal .modal-title { margin-bottom: 2px; }
#msgModal .modal-subtitle { margin: 0 0 10px; color: #6b7280; }

#msgModal .search-wrap { position: relative; }

#msgModal .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .55;
  font-size: 16px;
  pointer-events: none;
}

#msgModal #msgSearch {
  width: 100%;
  padding: 10px 12px 10px 36px; /* space for icon */
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  font-size: 0.95rem;
}
#msgModal #msgSearch:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.15);
}

/* nice suggestions */
#msgModal #msgSugg { max-height: 50vh; overflow: auto; }
#msgModal #msgSugg .sugg-item { display: flex; align-items: center; gap: 8px; }
#msgModal #msgSugg .sugg-item i { opacity: .65; }


/* Message modal — better close button + spacing */
#msgModal .modal-dialog { position: relative; }

#msgModal .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  cursor: pointer;
  transition: background .15s, transform .08s;
}
#msgModal .modal-close:hover { background: #f8fafc; }
#msgModal .modal-close:active { transform: translateY(1px); }

#msgModal .modal-title { margin: 4px 0 2px; }
#msgModal .modal-subtitle { margin: 0 0 10px; color: #6b7280; }


/* === Attachments preview (composer + comments) === */
.attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.attachments-preview .attachment {
  position: relative;
  width: 200px;   /* was 120px */
  height: 200px;  /* was 120px */
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e6ebf2;
  background: #fff;
  box-shadow: 0 2px 8px rgba(16,24,40,0.06);
  animation: fade-in 200ms ease;
}

.attachments-preview .attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.attachments-preview .remove-attachment {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 18px;
  line-height: 26px;
  cursor: pointer;
  transition: opacity var(--transition);
}
.attachments-preview .remove-attachment:hover {
  opacity: 0.85;
}
