:root {
  --app-bg: #f7f9fc;
  --app-text: #1f2937;
  --app-card-bg: #ffffff;
  --app-border: #dbe3f0;
  --app-muted: #6b7280;
  --app-input-bg: #ffffff;
  --app-input-text: #111827;
  --app-input-border: #cbd5e1;
}

html[data-theme="dark"] {
  --app-bg: #0b1220;
  --app-text: #e5e7eb;
  --app-card-bg: #111827;
  --app-border: #334155;
  --app-muted: #cbd5e1;
  --app-input-bg: #0f172a;
  --app-input-text: #e5e7eb;
  --app-input-border: #475569;
}

body {
  background-color: var(--app-bg);
  color: var(--app-text);
}

.card,
.accordion-item,
.table,
.list-group-item {
  background-color: var(--app-card-bg) !important;
  border-color: var(--app-border);
  color: var(--app-text);
}

.card .card-body {
  color: var(--app-text);
}

.text-muted {
  color: var(--app-muted) !important;
}

html[data-theme="dark"] .text-body {
  color: var(--app-text) !important;
}

html[data-theme="dark"] .badge.text-bg-primary-subtle,
html[data-theme="dark"] .badge.text-primary-emphasis {
  background-color: rgba(96, 165, 250, 0.22) !important;
  border-color: rgba(147, 197, 253, 0.45) !important;
  color: #bfdbfe !important;
}

.form-control,
.form-select {
  background-color: var(--app-input-bg);
  color: var(--app-input-text);
  border-color: var(--app-input-border);
}

.form-control:focus,
.form-select:focus {
  background-color: var(--app-input-bg);
  color: var(--app-input-text);
}

.form-control::placeholder,
.form-select::placeholder {
  color: var(--app-muted);
  opacity: 1;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  color: #f8fafc;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] .form-select::placeholder {
  color: #94a3b8;
}

html[data-theme="dark"] .bg-light {
  background-color: #0f172a !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-bottom {
  border-color: var(--app-border) !important;
}

.admin-subcard {
  background-color: transparent;
}

html[data-theme="dark"] .admin-subcard {
  background-color: #162033;
}

.admin-layout {
  align-items: flex-start;
}

.admin-sidebar {
  position: sticky;
  top: 1rem;
}

.admin-menu .list-group-item {
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  background-color: transparent !important;
  color: var(--app-text);
}

.admin-menu .list-group-item:hover,
.admin-menu .list-group-item:focus {
  background-color: rgba(13, 110, 253, 0.08) !important;
  color: var(--app-text);
}

html[data-theme="dark"] .admin-menu .list-group-item:hover,
html[data-theme="dark"] .admin-menu .list-group-item:focus {
  background-color: #1a2740 !important;
}

.admin-section + .admin-section {
  margin-top: 1rem;
}


.admin-metric {
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  background-color: rgba(13, 110, 253, 0.04);
}

.admin-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}
.admin-metric-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-muted);
  margin-top: 0.2rem;
}
.admin-table {
  margin-bottom: 0;
}
.admin-table thead th {
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.74rem;
  border-bottom-color: var(--app-border);
}
.admin-table td {
  border-color: var(--app-border);
}
.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-role-handle-col {
  width: 1%;
  white-space: nowrap;
}

.admin-role-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--app-border);
  border-radius: 0.35rem;
  color: var(--app-muted);
  cursor: grab;
  user-select: none;
}

.admin-role-row.is-dragging {
  opacity: 0.55;
}

.admin-role-row.is-dragging .admin-role-drag-handle {
  cursor: grabbing;
}

.admin-audit-log .list-group-item:first-child {
  padding-top: 0 !important;
}

@media (min-width: 992px) {
  .border-start-lg {
    border-left: 1px solid var(--app-border);
  }
}

.admin-shortcut-card {
  display: block;
  height: 100%;
  width: 100%;
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  padding: 0.85rem 0.9rem;
  background-color: var(--app-card-bg);
  color: var(--app-text);
  text-decoration: none;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

button.admin-shortcut-card {
  font: inherit;
  cursor: pointer;
}

.admin-shortcut-card:hover,
.admin-shortcut-card:focus {
  border-color: rgba(13, 110, 253, 0.45);
  box-shadow: 0 0.35rem 1rem rgba(13, 110, 253, 0.08);
  color: var(--app-text);
  transform: translateY(-1px);
}

.admin-shortcut-title {
  font-weight: 600;
}

.admin-shortcut-meta {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--app-muted);
}

.admin-status-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.admin-status-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px dashed var(--app-border);
  font-size: 0.92rem;
}

.admin-status-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.rule-tree {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.rule-category-card {
  border: 1px solid var(--app-border);
  border-radius: 0.9rem;
  background-color: var(--app-card-bg);
  padding: 0.85rem;
  cursor: grab;
}

.rule-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.rule-category-rename {
  border: 1px solid var(--app-border);
  border-radius: 0.65rem;
  padding: 0.55rem;
  margin-bottom: 0.65rem;
  background-color: var(--app-card-bg);
}

.rule-subcategory-rename {
  border: 1px solid var(--app-border);
  border-radius: 0.6rem;
  padding: 0.5rem;
  margin-bottom: 0.55rem;
  background-color: var(--app-card-bg);
}

.rule-subcategory-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.rule-subcategory-card {
  border: 1px dashed var(--app-border);
  border-radius: 0.75rem;
  background-color: rgba(13, 110, 253, 0.04);
  padding: 0.65rem;
  cursor: grab;
}

.rule-subcategory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.rule-item-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 2.5rem;
}

.rule-empty-drop {
  border: 1px dashed var(--app-border);
  border-radius: 0.6rem;
  padding: 0.4rem 0.55rem;
  text-align: center;
  background-color: var(--app-card-bg);
}

.rule-item {
  border: 1px solid var(--app-border);
  border-radius: 0.65rem;
  background-color: var(--app-card-bg);
  padding: 0.6rem;
  cursor: grab;
}

.rule-item-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.rule-item-summary-content {
  min-width: 0;
}

.rule-item-editor {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--app-border);
}

.rule-inline-layout {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.rule-inline-form {
  flex: 1 1 auto;
}

.rule-inline-delete-form {
  flex: 0 0 auto;
  margin-top: 1.4rem;
}

.rule-dragging {
  opacity: 0.55;
}

.rule-category-picker .dropdown-toggle {
  min-width: 5.25rem;
}

.rule-category-menu {
  max-height: 16rem;
  overflow-y: auto;
}

html[data-theme="dark"] .rule-category-menu {
  background-color: #0f172a;
  border-color: var(--app-border);
}

html[data-theme="dark"] .rule-category-menu .dropdown-item {
  color: var(--app-text);
}

html[data-theme="dark"] .rule-category-menu .dropdown-item:hover,
html[data-theme="dark"] .rule-category-menu .dropdown-item:focus {
  background-color: #1a2740;
  color: #f8fafc;
}

html[data-theme="dark"] .rule-subcategory-card {
  background-color: #0f1b2d;
}

html[data-theme="dark"] .rule-empty-drop {
  background-color: #101a2a;
}


html[data-theme="dark"] .rule-subcategory-rename {
  background-color: #101a2a;
}
html[data-theme="dark"] .admin-metric {
  background-color: #111d31;
}
html[data-theme="dark"] .admin-shortcut-card {
  background-color: #101a2a;
}

html[data-theme="dark"] .admin-shortcut-card:hover,
html[data-theme="dark"] .admin-shortcut-card:focus {
  box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.5);
}

html[data-theme="dark"] .modal-content {
  background-color: var(--app-card-bg);
  border-color: var(--app-border);
  color: var(--app-text);
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
  border-color: var(--app-border);
}

html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .modal .form-label {
  color: var(--app-text);
}

html[data-theme="dark"] .modal .btn-close {
  filter: invert(1) grayscale(100%) brightness(180%);
}

html[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--app-text);
  --bs-table-border-color: var(--app-border);
  --bs-table-striped-bg: #132035;
  --bs-table-striped-color: var(--app-text);
  --bs-table-hover-bg: #1a2a44;
  --bs-table-hover-color: var(--app-text);
}

html[data-theme="dark"] .pagination .page-link {
  background-color: #0f172a;
  border-color: var(--app-border);
  color: var(--app-text);
}

html[data-theme="dark"] .pagination .page-item.disabled .page-link {
  background-color: #0b1220;
  color: #94a3b8;
}

html[data-theme="dark"] .pagination .page-item.active .page-link,
html[data-theme="dark"] .pagination .page-link:hover {
  background-color: #1e293b;
  color: #f8fafc;
}

@media (max-width: 1199.98px) {
  .admin-sidebar {
    position: static;
  }

  .rule-item-summary {
    flex-direction: column;
  }

  .rule-inline-layout {
    flex-direction: column;
  }

  .rule-inline-delete-form {
    margin-top: 0;
    width: 100%;
  }

  .rule-inline-delete-form .btn {
    width: 100%;
  }
}

.card-post-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: 50% 50%;
  background-color: #0f172a;
}

@media (min-width: 1200px) {
  .single-post-shell {
    max-width: 920px;
  }
}

.sidebar-card + .sidebar-card {
  margin-top: 1rem;
}

.events-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}

.events-calendar-weekday {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--app-muted);
  text-align: center;
  padding-bottom: 0.2rem;
}

.events-calendar-day {
  border: 1px solid var(--app-border);
  border-radius: 0.55rem;
  min-height: 7.2rem;
  padding: 0.35rem;
  background-color: var(--app-card-bg);
}

.events-calendar-day-empty {
  background-color: transparent;
  border-style: dashed;
  opacity: 0.45;
}

.events-calendar-day-today {
  box-shadow: inset 0 0 0 1px #0d6efd;
}

.events-calendar-day-number {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.events-calendar-items {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.events-calendar-item {
  border-radius: 0.45rem;
  padding: 0.15rem 0.3rem;
  font-size: 0.7rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.events-calendar-item-btn {
  display: block;
  width: 100%;
  border: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.events-calendar-item-btn:hover {
  filter: brightness(0.98);
}

.events-calendar-item-btn:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 1px;
}

.events-calendar-item-event {
  background-color: rgba(13, 110, 253, 0.12);
}

.events-calendar-item-dugnad {
  background-color: rgba(255, 193, 7, 0.25);
}

.events-calendar-item-time {
  font-weight: 700;
  margin-right: 0.25rem;
}

.events-calendar-item-title {
  font-weight: 500;
}

.events-calendar-more {
  font-size: 0.7rem;
  color: var(--app-muted);
}

.events-calendar-compact {
  gap: 0.35rem;
}

.events-calendar-compact .events-calendar-day {
  min-height: 4.6rem;
  padding: 0.28rem;
}

.events-calendar-compact .events-calendar-item {
  font-size: 0.64rem;
  padding: 0.1rem 0.24rem;
}

.events-calendar-compact .events-calendar-day-number {
  margin-bottom: 0.18rem;
}

.events-item-past {
  opacity: 0.85;
}

.events-modal-description {
  white-space: pre-line;
}

html[data-theme="dark"] .events-calendar-day {
  background-color: #101a2a;
}

html[data-theme="dark"] .events-calendar-item-event {
  background-color: #1b3a66;
}

html[data-theme="dark"] .events-calendar-item-dugnad {
  background-color: #5a4a10;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 0 0.6rem 0;
  overflow: hidden;
  background-color: #e2e8f0;
  color: #334155;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar-fallback {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.user-avatar-sm {
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.68rem;
}

.user-avatar-xl {
  width: 4rem;
  height: 4rem;
  font-size: 1.12rem;
}

.user-avatar-comment {
  width: 3.2rem;
  height: 3.2rem;
  font-size: 1rem;
  border: 0;
  border-right: 1px solid var(--app-border);
  border-bottom: 1px solid var(--app-border);
}

.comment-meta-row {
  min-height: 3.2rem;
  margin: -0.65rem -0.7rem 0 -0.7rem;
  gap: 0 !important;
}

.comment-meta {
  min-width: 0;
  width: 100%;
  gap: 0 !important;
  align-items: stretch !important;
}

.comment-meta-text {
  display: block;
  width: 100%;
  padding: 0.42rem 0.7rem 0.2rem 0.7rem;
}

@media (max-width: 575.98px) {
  .user-avatar-comment {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 0.92rem;
  }

  .comment-meta-row {
    min-height: 2.8rem;
  }
}

html[data-theme="dark"] .user-avatar {
  background-color: #334155;
  color: #f8fafc;
}

.about-profile {
  display: grid;
  grid-template-columns: minmax(8rem, 13rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
}

.about-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.about-widget-header .btn {
  flex: 0 0 auto;
}

.about-image-wrap {
  width: 100%;
}

.about-image,
.about-default-building {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  border-radius: 0.65rem;
  border: 1px solid var(--app-border);
  background-color: #eaf2ff;
  object-fit: cover;
}

.about-default-sky {
  fill: #eaf2ff;
}

.about-default-body {
  fill: #ffffff;
  stroke: #334155;
  stroke-width: 2;
}

.about-default-roof {
  fill: #0d6efd;
}

.about-default-windows rect {
  fill: #b9d7ff;
  stroke: #334155;
  stroke-width: 1;
}

.about-default-door {
  fill: #475569;
}

.about-default-ground {
  stroke: #334155;
  stroke-width: 2;
  stroke-linecap: round;
}

.about-profile-copy {
  min-width: 0;
}

.about-info-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.about-info-list > div {
  display: grid;
  grid-template-columns: minmax(8rem, 35%) minmax(0, 1fr);
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--app-border);
}

.about-info-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.about-info-list dt {
  color: var(--app-muted);
  font-weight: 700;
}

.about-info-list dd {
  margin-bottom: 0;
}

.about-document-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.about-document-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--app-border);
  border-radius: 0.65rem;
  padding: 0.65rem;
  background-color: var(--app-card-bg);
}

.about-document-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.8rem;
  height: 2.1rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background-color: #dc3545;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.about-document-copy {
  min-width: 0;
}

html[data-theme="dark"] .about-image,
html[data-theme="dark"] .about-default-building,
html[data-theme="dark"] .about-document-item {
  background-color: #101a2a;
}

html[data-theme="dark"] .about-default-sky {
  fill: #132035;
}

html[data-theme="dark"] .about-default-body {
  fill: #1f2937;
  stroke: #cbd5e1;
}

html[data-theme="dark"] .about-default-windows rect {
  fill: #315983;
  stroke: #cbd5e1;
}

html[data-theme="dark"] .about-default-door {
  fill: #94a3b8;
}

html[data-theme="dark"] .about-default-ground {
  stroke: #cbd5e1;
}

.comment-box {
  border-left: 3px solid var(--app-border);
  padding-left: 0.75rem;
  margin-bottom: 0.75rem;
}

.comment-thread {
  border: 1px solid var(--app-border);
  border-left-width: 3px;
  border-radius: 0.6rem;
  padding: 0.65rem 0.7rem;
  background-color: var(--app-card-bg);
  overflow: hidden;
}

.post-comment-card.comment-box {
  border-left: 0;
  padding-left: 0;
}

.post-comment-card.comment-thread {
  border-left-width: 1px;
  padding: 0;
}

.post-comment-card .comment-meta-author {
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
  gap: 0;
}

.post-comment-card .comment-meta-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  width: 100%;
  padding: 0.42rem 0.7rem 0.32rem 0.7rem;
}

.post-comment-card .comment-card-content {
  padding: 0.85rem 1rem 0.75rem;
}

.post-comment-card .comment-card-footer {
  border-top: 1px solid var(--app-border);
  padding: 0.62rem 1rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.post-comment-card .comment-reactions {
  margin: 0;
}

.post-comment-card .comment-footer-actions {
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-comment-card .comment-thread-children-wrap {
  padding: 0 1rem 0.9rem;
}
.comment-body {
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.comment-children {
  margin-top: 0.65rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--app-border);
}

.comment-children-capped {
  padding-left: 0;
  border-left: 0;
}

.comment-children-shell {
  position: relative;
  min-height: 1.35rem;
}

.comment-thread-line-toggle {
  position: absolute;
  top: 0;
  left: 0;
  width: 0.95rem;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}

.comment-thread-line-toggle::before {
  content: "";
  position: absolute;
  left: 0.38rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: var(--app-border);
  transition: width 0.15s ease, left 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.comment-thread-line-toggle:hover::before,
.comment-thread-line-toggle:focus-visible::before,
.comment-children-shell:hover > .comment-thread-line-toggle::before {
  width: 3px;
  left: 0.29rem;
  background-color: #0b5ed7;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.18);
}

.comment-thread-line-toggle:focus-visible {
  outline: none;
}

.comment-thread-line-toggle.is-collapsed {
  height: 1.25rem;
}

.comment-reply-toggle {
  min-width: 4.5rem;
}

.comment-reply-form-container {
  margin-left: 0;
}

.comment-level-1 {
  margin-left: 0.5rem;
  margin-bottom: 0.45rem;
}

.comment-level-2,
.comment-level-3,
.comment-level-4 {
  margin-left: 1rem;
  margin-bottom: 0.45rem;
}


.board-role-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.board-role-section {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--app-border);
}

.board-role-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.board-member-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.board-member-item {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--app-border);
  border-radius: 0.6rem;
  overflow: hidden;
  background-color: var(--app-card-bg);
}

.user-avatar-board {
  width: 3.2rem;
  height: 3.2rem;
  font-size: 1rem;
  border: 0;
  border-right: 1px solid var(--app-border);
  border-bottom: 1px solid var(--app-border);
  flex: 0 0 auto;
}

.board-member-content {
  min-width: 0;
  width: 100%;
  padding: 0.45rem 0.7rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 991.98px) {
  .board-member-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .board-member-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 575.98px) {
  .user-avatar-board {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 0.9rem;
  }

  .about-profile,
  .about-info-list > div,
  .about-document-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .about-document-item form {
    justify-self: stretch;
  }

  .about-document-item form .btn {
    width: 100%;
  }
}


.feed-post-card {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.feed-post-card:hover,
.feed-post-card:focus-visible {
  transform: translateY(-2px);
  border-color: #9fb4d8;
  box-shadow: 0 0.75rem 1.5rem rgba(15, 23, 42, 0.1);
}

.feed-post-card:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

.feed-post-card.bulletin-post-card {
  display: flex;
  flex-direction: column;
}

.home-feed-post-card.has-image .card-post-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: none;
  object-fit: cover;
  display: block;
}
.home-feed-post-card.bulletin-post-card:not(.has-image) .bulletin-post-preview.is-truncated {
  max-height: 8.5rem;
}
.bulletin-comment-count {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--app-muted);
  font-weight: 600;
  line-height: 1;
  cursor: default;
}
.bulletin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  align-items: stretch;
}

.bulletin-grid .bulletin-post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 27rem;
}

.bulletin-post-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.bulletin-card-header {
  flex: 0 0 auto;
}

.bulletin-card-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0.95rem 1rem 0.75rem;
}

.bulletin-card-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 0.65rem 1rem 0.9rem;
  border-top: 1px solid var(--app-border);
}

.bulletin-footer-reactions {
  margin-bottom: 0.55rem;
}

.bulletin-footer-actions {
  min-height: 2rem;
}

.bulletin-meta-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.2rem;
  margin: 0;
  border-bottom: 1px solid var(--app-border);
}

.bulletin-meta-author {
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
  gap: 0;
}

.bulletin-meta-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  width: 100%;
  padding: 0.42rem 0.7rem 0.32rem 0.7rem;
}

.bulletin-meta-date {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  white-space: nowrap;
  text-align: right;
  padding: 0.46rem 0.7rem 0.3rem 0;
}

html[data-theme="dark"] .bulletin-meta-copy,
html[data-theme="dark"] .bulletin-meta-date {
  color: var(--app-muted) !important;
}

html[data-theme="dark"] .bulletin-meta-copy .fw-semibold {
  color: var(--app-text) !important;
}

@media (max-width: 575.98px) {
  .bulletin-meta-row {
    min-height: 2.8rem;
  }

  .bulletin-meta-date {
    font-size: 0.78rem;
    padding-top: 0.42rem;
  }
}

.bulletin-post-preview.is-truncated {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 8.5rem;
  overflow: hidden;
}

.bulletin-post-card:not(.has-image) .bulletin-post-preview.is-truncated {
  max-height: none;
}

.bulletin-post-card.has-image .bulletin-post-preview.is-truncated {
  max-height: 5.6rem;
}

.bulletin-post-card.has-image .card-post-image {
  max-height: 11rem;
}
.home-feed-post-card.bulletin-post-card.has-image .card-post-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: none;
  object-fit: cover;
  display: block;
}

.bulletin-post-preview.is-truncated::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.4rem;
  background: linear-gradient(180deg, transparent, var(--app-card-bg));
  pointer-events: none;
}

.bulletin-read-more-hint {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--app-muted);
}

@media (min-width: 768px) {
  .bulletin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .bulletin-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .bulletin-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.post-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.post-reaction-form {
  margin: 0;
}

.post-reaction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.24rem;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  background-color: var(--app-card-bg);
  color: var(--app-text);
  padding: 0.24rem 0.45rem;
  font-size: 0.82rem;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.post-reaction-btn:hover {
  background-color: rgba(13, 110, 253, 0.08);
  border-color: rgba(13, 110, 253, 0.45);
}

.post-reaction-btn:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 1px;
}

.post-reaction-btn.is-active {
  background-color: rgba(13, 110, 253, 0.14);
  border-color: #0d6efd;
}

.post-reaction-emoji {
  font-size: 1rem;
  line-height: 1;
}

.post-reaction-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2ch;
  text-align: center;
  font-weight: 600;
  color: var(--app-muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 575.98px) {
  .post-reaction-btn {
    gap: 0.2rem;
    padding: 0.24rem 0.4rem;
  }
}

.rule-subcategory-details {
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  padding: 0.65rem;
  background-color: var(--app-card-bg);
}

.rule-subcategory-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.rule-subcategory-summary::-webkit-details-marker {
  display: none;
}

.rule-subcategory-title {
  color: var(--app-text);
}

.rule-subcategory-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.rule-subcategory-toggle-text::before {
  content: "Skjul";
  color: var(--app-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.rule-subcategory-details:not([open]) .rule-subcategory-toggle-text::before {
  content: "Vis";
}

.rules-subcategory-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rules-edit-rule {
  cursor: grab;
}

.rules-edit-rule.rule-dragging {
  opacity: 0.55;
}

.rules-category-section[draggable="true"],
.rule-subcategory-details[draggable="true"] {
  cursor: grab;
}

.rules-new-category-dropzone {
  border: 2px dashed var(--app-border);
  border-radius: 0.7rem;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.65rem;
  background-color: var(--app-card-bg);
  color: var(--app-muted);
  font-weight: 600;
}

.rules-new-category-dropzone-active {
  border-color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.1);
  color: var(--app-text);
}

.rules-category-dropzone {
  border: 1px dashed var(--app-border);
  border-radius: 0.65rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  color: var(--app-muted);
  background-color: var(--app-card-bg);
}

.rules-category-dropzone-active {
  border-color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.1);
  color: var(--app-text);
}

.rules-category-rename summary {
  cursor: pointer;
}

.rules-edit-panel {
  position: sticky;
  top: 0.9rem;
}

.rules-edit-panel .rules-edit-view-actions,
.rules-edit-panel .rules-edit-primary-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.rules-edit-panel .rules-edit-view-actions .btn,
.rules-edit-panel .rules-edit-primary-actions .btn {
  width: 100%;
  text-align: left;
}

.rules-edit-panel .rules-edit-form-vertical > [class*="col-"] {
  flex: 0 0 100%;
  max-width: 100%;
}

.rules-edit-panel .rules-edit-form-vertical .btn[type="submit"] {
  width: 100%;
}

.rules-edit-panel .rules-category-dropdown .dropdown-menu {
  max-height: 15rem;
  overflow-y: auto;
}

html[data-theme="dark"] .rules-edit-panel .rules-category-dropdown .dropdown-menu {
  background-color: #0f172a;
  border-color: var(--app-border);
}

html[data-theme="dark"] .rules-edit-panel .rules-category-dropdown .dropdown-item {
  color: var(--app-text);
}

html[data-theme="dark"] .rules-edit-panel .rules-category-dropdown .dropdown-item:hover,
html[data-theme="dark"] .rules-edit-panel .rules-category-dropdown .dropdown-item:focus {
  background-color: #1a2740;
  color: #f8fafc;
}

.rules-edit-panel .rules-edit-advanced summary {
  cursor: pointer;
}

@media (max-width: 1199.98px) {
  .rules-edit-panel {
    position: static;
  }
}

html[data-theme="dark"] .rules-new-category-dropzone {
  background-color: #101a2a;
}

html[data-theme="dark"] .rules-category-dropzone {
  background-color: #101a2a;
}

.building-map-wrap {
  border: 1px solid var(--app-border);
  border-radius: 0.85rem;
  padding: 0.75rem;
  background-color: var(--app-card-bg);
  overflow: auto;
}

.building-map-canvas {
  position: relative;
  width: max(100%, var(--map-canvas-width, 1500px));
  height: var(--map-canvas-height, 900px);
  min-width: 900px;
  min-height: 500px;
  border: 1px solid #1f2937;
  border-radius: 0.25rem;
  background-color: #f9fafb;
  background-image: linear-gradient(to right, rgba(15, 23, 42, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.18) 1px, transparent 1px);
  background-size: calc(100% / var(--map-grid-cols, 20)) calc(100% / var(--map-grid-rows, 14));
  overflow: hidden;
}

.building-map-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.building-map-item {
  position: absolute;
  border-radius: 0;
  padding: 0.32rem 0.38rem;
  border: 1px solid #1f2937;
  box-shadow: none;
  overflow: hidden;
}

.map-item-unit {
  background-color: #f3f4f6;
}

.map-item-unit-visible {
  background-color: #fef9c3;
  border-color: #92400e;
}

.map-item-stairwell {
  background-color: #93acd8;
  border-color: #334155;
}

.map-item-title {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.18rem;
}

.map-item-body {
  font-size: 0.72rem;
  line-height: 1.25;
}

.map-item-move,
.map-item-resize {
  position: absolute;
  border: 0;
  border-radius: 999px;
  background-color: #0d6efd;
  color: #fff;
  font-size: 0.68rem;
  padding: 0.08rem 0.42rem;
}

.map-item-move {
  top: 0.25rem;
  right: 0.25rem;
  cursor: grab;
}

.map-item-resize {
  right: 0.25rem;
  bottom: 0.2rem;
  cursor: nwse-resize;
}

.map-item-active-drag {
  opacity: 0.8;
}

.map-unit-list .map-unit-edit-toggle {
  min-width: 5rem;
}

.building-map-sidebar .map-sidebar-card {
  border: 1px solid var(--app-border);
}

.map-sidebar-card-body {
  padding: 1rem;
}

.building-map-sidebar .map-sidebar-card .map-sidebar-card-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.map-sidebar-title {
  margin-bottom: 0.2rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.map-sidebar-help {
  margin: 0 0 0.75rem;
  color: var(--app-muted);
  font-size: 0.8rem;
}

.map-sidebar-form .form-label {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.map-sidebar-scroll {
  max-height: 22rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.building-map-sidebar .map-sidebar-card .map-sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.map-unit-row,
.map-item-row {
  border: 1px solid var(--app-border);
  border-radius: 0.65rem;
  background-color: var(--app-card-bg);
  padding: 0.65rem;
}

.map-item-row-compact {
  padding: 0.45rem 0.5rem;
}

.map-unit-row-compact {
  padding: 0.45rem 0.5rem;
}

.map-unit-row-compact .map-unit-meta {
  font-size: 0.78rem;
  line-height: 1.2;
}

.map-unit-row-compact .map-unit-actions .btn,
.map-unit-row-compact .map-unit-edit-toggle {
  min-width: 3.7rem;
  padding: 0.2rem 0.5rem;
}

.map-item-form-compact .form-select,
.map-item-form-compact .form-control {
  min-height: calc(1.5em + 0.35rem + 2px);
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
}

.map-item-form-compact .map-item-actions .btn {
  min-width: 3.7rem;
  padding: 0.2rem 0.5rem;
}

.map-unit-row .btn,
.map-item-row .btn {
  white-space: nowrap;
}

html[data-theme="dark"] .map-unit-row,
html[data-theme="dark"] .map-item-row {
  background-color: #101a2a;
}

.map-legend-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid transparent;
}

.map-legend-dot-active {
  background-color: #fef9c3;
  border-color: #92400e;
}

.map-legend-dot-muted {
  background-color: #f3f4f6;
  border-color: #1f2937;
}

.map-legend-dot-stair {
  background-color: #93acd8;
  border-color: #334155;
}

html[data-theme="dark"] .building-map-wrap {
  background-color: #101a2a;
}

html[data-theme="dark"] .building-map-canvas {
  background-color: #0f172a;
  border-color: #475569;
  background-image: linear-gradient(to right, rgba(148, 163, 184, 0.32) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.32) 1px, transparent 1px);
  background-size: calc(100% / var(--map-grid-cols, 20)) calc(100% / var(--map-grid-rows, 14));
}

html[data-theme="dark"] .map-item-unit {
  background-color: #1f2937;
  border-color: #64748b;
}

html[data-theme="dark"] .map-item-unit-visible {
  background-color: #365314;
  border-color: #a3e635;
}

html[data-theme="dark"] .map-item-stairwell {
  background-color: #334e7a;
  border-color: #93c5fd;
}

html[data-theme="dark"] .map-legend-dot-active {
  background-color: #365314;
  border-color: #a3e635;
}

html[data-theme="dark"] .map-legend-dot-muted {
  background-color: #1f2937;
  border-color: #64748b;
}

html[data-theme="dark"] .map-legend-dot-stair {
  background-color: #334e7a;
  border-color: #93c5fd;
}

.flash-overlay {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1085;
  width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}

.flash-overlay-item {
  pointer-events: auto;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.18);
}

.post-editor-toolbar .btn,
.post-editor-toolbar .form-select {
  min-height: 32px;
}

.post-editor-surface {
  min-height: 260px;
  background-color: var(--app-input-bg);
  color: var(--app-input-text);
  border-color: var(--app-input-border) !important;
  overflow-wrap: break-word;
}

.post-editor-surface:focus {
  outline: 0;
  box-shadow: inset 0 0 0 2px #0d6efd33;
}

.post-preview-body p:last-child,
.post-body-content p:last-child {
  margin-bottom: 0;
}

.post-preview-body img,
.post-body-content img {
  max-width: 100%;
  height: auto;
}

.image-crop-preview-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: #0f172a;
}

#post-preview-image,
#bulletin-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: grab;
  touch-action: none;
  transform-origin: 50% 50%;
  transition: transform 0.1s ease;
}

#post-preview-image.is-focus-dragging,
#bulletin-preview-image.is-focus-dragging {
  cursor: grabbing;
}

.post-image-focus-controls {
  border: 1px solid var(--app-border);
  border-radius: 0.65rem;
  padding: 0.7rem 0.8rem;
  background-color: var(--app-card-bg);
}

.post-image-focus-controls.is-disabled {
  opacity: 0.65;
}

.media-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 1px solid var(--app-border);
  background: #0f172a;
}

.media-card {
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  height: 100%;
  background-color: var(--app-card-bg);
}

.media-card > .btn {
  width: 100%;
}

.upload-dropzone {
  border: 2px dashed var(--app-border);
  border-radius: 0.75rem;
  padding: 0.8rem 1rem;
  text-align: center;
  color: var(--app-muted);
  background-color: var(--app-card-bg);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone.upload-dropzone-active {
  border-color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.12);
}

html[data-theme="dark"] .upload-dropzone {
  background-color: #101a2a;
}

html[data-theme="dark"] .upload-dropzone:hover,
html[data-theme="dark"] .upload-dropzone.upload-dropzone-active {
  background-color: #17253b;
}

@media (max-width: 575.98px) {
  .events-calendar {
    gap: 0.3rem;
  }

  .events-calendar-day {
    min-height: 5.6rem;
    padding: 0.25rem;
  }

  .events-calendar-item {
    font-size: 0.64rem;
    padding: 0.1rem 0.22rem;
  }

  .events-calendar-day-number {
    font-size: 0.72rem;
  }

  .building-map-canvas {
    min-height: 500px;
    min-width: 760px;
  }

  .flash-overlay {
    top: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}

@media (max-width: 1199.98px) {
  .map-sidebar-scroll {
    max-height: none;
  }
}


.bulletin-full-post .bulletin-card-content {
  padding: 1.1rem 1.15rem 0.9rem;
}

.bulletin-full-post .bulletin-card-footer {
  padding: 0.7rem 1.15rem 1rem;
}


.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background-color: #dc3545;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.notification-list .notification-item {
  border-color: var(--app-border);
}

.notification-item.notification-item-rich {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 0.95rem;
}

.notification-avatar-wrap {
  align-self: start;
}

.notification-avatar.user-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.notification-content-wrap {
  min-width: 0;
}

.notification-primary-text {
  line-height: 1.3;
}

.notification-time {
  white-space: nowrap;
  font-size: 0.78rem;
}

.notification-preview-line {
  position: relative;
  margin-top: 0.32rem;
  font-size: 0.9rem;
  color: var(--app-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  padding-right: 2.4rem;
}

.notification-preview-line::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 2.6rem;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--app-card-bg));
}

.notification-right-badges {
  align-self: start;
  justify-self: end;
}

.notification-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
  background-color: rgba(13, 110, 253, 0.12);
  border: 1px solid rgba(13, 110, 253, 0.25);
}

.notification-item.is-unread {
  background-color: rgba(13, 110, 253, 0.08) !important;
}

.notification-item.is-read {
  background-color: #ffffff !important;
}

html[data-theme="dark"] .notification-item.is-read {
  background-color: #111827 !important;
}

html[data-theme="dark"] .notification-item.is-unread {
  background-color: rgba(59, 130, 246, 0.2) !important;
}

html[data-theme="dark"] .notification-emoji {
  background-color: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.35);
}

html[data-theme="dark"] .notification-preview-line::after {
  background: linear-gradient(90deg, rgba(17, 24, 39, 0), var(--app-card-bg));
}

@media (max-width: 575.98px) {
  .notification-item.notification-item-rich {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "avatar badges"
      "content content";
    gap: 0.5rem 0.7rem;
  }

  .notification-avatar-wrap {
    grid-area: avatar;
  }

  .notification-content-wrap {
    grid-area: content;
  }

  .notification-right-badges {
    grid-area: badges;
  }
}

.notification-highlight {
  animation: notificationPulse 2.4s ease;
}

/* Mobile install CTA */
.mobile-install-root {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 0.8rem);
  transform: translateX(-50%);
  z-index: 1060;
  width: min(92vw, 24rem);
  pointer-events: none;
}

.mobile-install-btn {
  width: 100%;
  pointer-events: auto;
  border-radius: 999px;
  box-shadow: 0 0.45rem 1.1rem rgba(13, 110, 253, 0.24);
}

html[data-theme="dark"] .mobile-install-btn {
  box-shadow: 0 0.45rem 1.1rem rgba(2, 6, 23, 0.65);
}

@keyframes notificationPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.6);
    background-color: rgba(13, 110, 253, 0.16);
  }
  40% {
    box-shadow: 0 0 0 12px rgba(13, 110, 253, 0);
    background-color: rgba(13, 110, 253, 0.12);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    background-color: transparent;
  }
}

/* Board chat widget */
.board-chat-widget {
  position: fixed;
  right: 1rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  z-index: 1070;
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

.board-chat-toggle,
.board-chat-panel {
  pointer-events: auto;
}

.board-chat-toggle {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.85rem;
  max-width: 100%;
  padding: 0.7rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: #0d6efd;
  color: #fff;
  box-shadow: 0 0.55rem 1.25rem rgba(15, 23, 42, 0.22);
  font-weight: 700;
}

.board-chat-toggle.has-unread {
  animation: boardChatPulse 1.8s ease-in-out infinite;
}

.board-chat-toggle-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.board-chat-toggle-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-chat-badge,
.board-chat-thread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.board-chat-panel {
  clear: both;
  display: flex;
  flex-direction: column;
  height: min(34rem, calc(100vh - 7rem));
  margin-bottom: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  background: var(--app-card-bg);
  color: var(--app-text);
  box-shadow: 0 0.8rem 2rem rgba(15, 23, 42, 0.24);
}

.board-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--app-border);
}

.board-chat-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.board-chat-status {
  min-height: 1rem;
  margin-top: 0.12rem;
  color: var(--app-muted);
  font-size: 0.78rem;
}

.board-chat-thread-list {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--app-border);
}

.board-chat-thread {
  flex: 0 0 10.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.4rem;
  align-items: center;
  min-height: 3.2rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--app-border);
  border-radius: 0.45rem;
  background: var(--bs-body-bg);
  color: var(--app-text);
  text-align: left;
}

.board-chat-thread.is-active {
  border-color: #0d6efd;
  box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.35);
}
.board-chat-thread-name,
.board-chat-thread-preview {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.board-chat-thread-name {
  font-weight: 700;
  font-size: 0.86rem;
}

.board-chat-thread-preview {
  grid-column: 1 / -1;
  color: var(--app-muted);
  font-size: 0.78rem;
}

.board-chat-empty-inline {
  color: var(--app-muted);
  font-size: 0.85rem;
  padding: 0.4rem 0.25rem;
}

.board-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.85rem;
  background: rgba(148, 163, 184, 0.08);
}

.board-chat-empty {
  display: grid;
  place-items: center;
  min-height: 10rem;
  color: var(--app-muted);
  text-align: center;
  font-size: 0.92rem;
}

.board-chat-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18rem;
  margin-bottom: 0.7rem;
}

.board-chat-message.is-own {
  align-items: flex-end;
}

.board-chat-message-meta {
  max-width: 82%;
  color: var(--app-muted);
  font-size: 0.72rem;
}

.board-chat-message-bubble {
  max-width: 82%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  background: var(--app-card-bg);
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.board-chat-message.is-own .board-chat-message-bubble {
  border-color: rgba(13, 110, 253, 0.4);
  background: #0d6efd;
  color: #fff;
}

.board-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  padding: 0.7rem;
  border-top: 1px solid var(--app-border);
  background: var(--app-card-bg);
}

.board-chat-form textarea {
  min-height: 2.65rem;
  max-height: 7rem;
  resize: vertical;
}

html[data-theme="dark"] .board-chat-thread {
  background: #101a2a;
}

html[data-theme="dark"] .board-chat-messages {
  background: rgba(15, 23, 42, 0.58);
}

@media (max-width: 575.98px) {
  .board-chat-widget {
    right: 0.65rem;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 0.65rem);
    width: calc(100vw - 1.3rem);
  }

  .board-chat-panel {
    height: min(32rem, calc(100vh - 5.5rem));
  }

  .board-chat-form {
    grid-template-columns: 1fr;
  }

  .board-chat-form .btn {
    width: 100%;
  }
}

@keyframes boardChatPulse {
  0% {
    box-shadow: 0 0.55rem 1.25rem rgba(15, 23, 42, 0.22), 0 0 0 0 rgba(220, 53, 69, 0.55);
  }
  70% {
    box-shadow: 0 0.55rem 1.25rem rgba(15, 23, 42, 0.22), 0 0 0 12px rgba(220, 53, 69, 0);
  }
  100% {
    box-shadow: 0 0.55rem 1.25rem rgba(15, 23, 42, 0.22), 0 0 0 0 rgba(220, 53, 69, 0);
  }
}
.board-chat-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.board-chat-header-actions .btn-close {
  margin-top: 0.25rem;
}