/* Notifications page: FORRE_DARK, data-dense and scan-first */
.tw-notif-page {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tw-notif-hero {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 9px 10px 9px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.tw-notif-hero-copy {
  min-width: 0;
}

.tw-notif-hero-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tw-notif-hero-title i {
  color: var(--primary);
  font-size: 11px;
}

.tw-notif-hero-meta {
  margin-top: 3px;
  font-size: 9px;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tw-notif-stats {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tw-notif-pill {
  border: 1px solid rgba(39, 150, 242, 0.35);
  background: rgba(39, 150, 242, 0.14);
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 7px;
  border-radius: 0;
  white-space: nowrap;
}

.tw-notif-pill.is-muted {
  border-color: var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
}

.tw-notif-list {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0;
  overflow: hidden;
}

.tw-notif-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  text-decoration: none;
  color: inherit;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(51, 51, 51, 0.5);
  transition: background-color var(--transition-speed) ease;
}

.tw-notif-item:last-child {
  border-bottom: 0;
}

.tw-notif-item:nth-child(even) {
  background: var(--surface-3);
}

.tw-notif-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.tw-notif-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 100%;
  background: transparent;
  transition: background-color var(--transition-speed) ease;
}

.tw-notif-item.is-unread::before {
  background: rgba(39, 150, 242, 0.8);
}

.tw-notif-item.is-priority {
  background: rgba(39, 150, 242, 0.06);
}

.tw-notif-item.is-priority::before {
  background: var(--primary);
}

.tw-notif-icon {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(39, 150, 242, 0.35);
  background: rgba(39, 150, 242, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 11px;
  border-radius: 0;
}

.tw-notif-content {
  min-width: 0;
}

.tw-notif-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

.tw-notif-message {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.tw-notif-meta {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.35);
}

.tw-notif-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.45);
  animation: twNotifPulse 1.5s infinite ease-in-out;
}

/* Klick ska släcka "Oläst"-signalerna direkt (JS togglar bara .is-unread på
   .tw-notif-item — se markElementRead i navbar.php). Opacity i st f
   display:none så det fadear i stället för att hoppa, och så mark-all-read
   (som också bara togglar klassen) får samma polerade beteende. */
.tw-notif-dot,
.tw-notif-meta-unread,
.tw-notif-unread {
  transition: opacity 0.15s ease;
}

.tw-notif-item:not(.is-unread) .tw-notif-dot,
.tw-notif-item:not(.is-unread) .tw-notif-meta-unread,
.tw-notif-item:not(.is-unread) .tw-notif-unread {
  opacity: 0;
  pointer-events: none;
}

.tw-notif-actions {
  display: inline-flex;
  gap: 6px;
}

.tw-notif-tail {
  min-width: 44px;
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 4px;
  padding-top: 1px;
}

.tw-notif-time {
  font-size: 8px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.tw-notif-unread {
  min-height: 14px;
  padding: 0 5px;
  border: 1px solid rgba(39, 150, 242, 0.35);
  background: rgba(39, 150, 242, 0.12);
  color: var(--primary);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
}

.tw-notif-go {
  color: var(--text-muted);
  font-size: 10px;
}

.tw-notif-item.is-unread .tw-notif-go {
  color: var(--primary);
}

.tw-notif-review-btn {
  min-width: 64px;
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  transition: all var(--transition-speed) ease;
}

.tw-notif-review-btn:hover {
  color: var(--text-primary);
  border-color: rgba(39, 150, 242, 0.4);
}

.tw-notif-review-btn[data-review-decision='approve']:hover {
  border-color: rgba(34, 197, 94, 0.5);
  color: var(--success);
}

.tw-notif-review-btn[data-review-decision='deny']:hover {
  border-color: rgba(231, 76, 60, 0.5);
  color: var(--danger);
}

.tw-notif-empty {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0;
  text-align: center;
  padding: 34px 16px;
}

.tw-notif-empty i {
  color: rgba(39, 150, 242, 0.45);
  font-size: 22px;
}

.tw-notif-empty h2 {
  margin: 10px 0 6px;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.tw-notif-empty p {
  margin: 0;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
}

.tw-notif-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.tw-notif-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.tw-notif-footer-link:hover {
  color: var(--primary-hover);
}

@keyframes twNotifPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 768px) {
  .tw-notif-hero { grid-template-columns: 1fr; }

  .tw-notif-stats {
    justify-content: flex-start;
  }

  .tw-notif-item {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
  }

  .tw-notif-tail {
    grid-column: 2 / 3;
    justify-items: start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-top: 0;
  }

  .tw-notif-time {
    font-size: 9px;
  }

  .tw-notif-actions {
    grid-column: 2 / 3;
    margin-top: 4px;
  }

  .tw-notif-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

.tw-notif-settings-form {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tw-notif-settings-alert {
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.tw-notif-settings-alert.is-success {
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--success);
  background: rgba(34, 197, 94, 0.08);
}

.tw-notif-settings-alert.is-error {
  border-color: rgba(231, 76, 60, 0.45);
  color: var(--danger);
  background: rgba(231, 76, 60, 0.08);
}

.tw-notif-settings-status {
  border: 1px solid rgba(51, 51, 51, 0.65);
  background: var(--surface-1);
  color: var(--text-secondary);
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.tw-notif-settings-status.is-dirty {
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.tw-notif-settings-status.is-saving {
  border-color: rgba(39, 150, 242, 0.45);
  color: var(--primary);
  background: rgba(39, 150, 242, 0.1);
}

.tw-notif-settings-section {
  border: 1px solid rgba(51, 51, 51, 0.6);
  background: var(--surface-1);
  border-radius: 0;
  padding: 12px;
}

.tw-notif-settings-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-primary);
}

.tw-notif-settings-grid {
  display: grid;
  gap: 8px;
}

.tw-notif-setting-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(51, 51, 51, 0.4);
  background: var(--surface-3);
  padding: 10px;
  cursor: pointer;
}

.tw-notif-setting-item:hover {
  border-color: rgba(39, 150, 242, 0.4);
  background: rgba(39, 150, 242, 0.06);
}

.tw-notif-setting-item input[type='checkbox'] {
  margin-top: 2px;
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}

.tw-notif-setting-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tw-notif-setting-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.4px;
}

.tw-notif-setting-desc {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.4;
}

.tw-notif-settings-actions {
  display: flex;
  justify-content: flex-end;
}

.tw-notif-settings-save {
  border: 1px solid rgba(39, 150, 242, 0.45);
  background: rgba(39, 150, 242, 0.14);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 10px;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 0;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.tw-notif-settings-save:hover {
  border-color: var(--primary);
  background: rgba(39, 150, 242, 0.22);
  color: var(--text-primary);
}

.tw-notif-settings-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---- Notifications P0: mobile community cards (desktop preserved) ---- */
.tw-notif-type-pill {
  display: none;
}

.tw-notif-meta-typename {
  margin-left: 6px;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.35);
}

.tw-notif-meta-unread,
.tw-notif-meta-read {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tw-notif-meta-read {
  color: rgba(255, 255, 255, 0.28);
}

.tw-notif-item-hit {
  text-decoration: none;
  color: inherit;
}

.tw-notif-item--has-hit {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.tw-notif-item--has-hit .tw-notif-item-hit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
}

.tw-notif-item--has-hit .tw-notif-actions,
.tw-notif-item--has-hit .tw-notif-p0-actions,
.tw-notif-item--has-hit .tw-notif-p0-banner {
  padding: 0 10px 8px;
}

.tw-notif-p0-mobile-only {
  display: none;
}

.tw-notif-empty-sub {
  margin: 0;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
}

@media (max-width: 768px) {
  .tw-notif-page--p0 .tw-notif-hero {
    padding: 8px 10px;
  }

  .tw-notif-p0-hero-meta {
    display: none;
  }

  .tw-notif-page--p0 .tw-notif-stats {
    flex-wrap: wrap;
  }

  .tw-notif-p0-mobile-only {
    display: flex;
  }

  .tw-notif-type-pill {
    display: block;
    margin: 0 0 4px;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
  }

  .tw-notif-meta-typename {
    display: none;
  }

  article[data-tw-notif-group]::before {
    content: attr(data-tw-notif-group);
    display: block;
    margin: 10px 0 6px;
    padding: 0 2px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
    border-left: 2px solid rgba(39, 150, 242, 0.65);
    padding-left: 8px;
  }

  .tw-notif-list--p0 {
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: visible;
  }

  .tw-notif-card {
    border: 1px solid var(--border);
    background: var(--surface-2);
  }

  .tw-notif-list--p0 .tw-notif-item,
  .tw-notif-list--p0 .tw-notif-item:nth-child(even) {
    border-bottom: 0;
    background: transparent;
  }

  .tw-notif-list--p0 .tw-notif-item:hover,
  .tw-notif-list--p0 .tw-notif-item:nth-child(even):hover {
    background: rgba(255, 255, 255, 0.02);
  }

  .tw-notif-item--has-hit .tw-notif-item-hit:hover {
    background: rgba(255, 255, 255, 0.02);
  }

  .tw-notif-dest {
    margin-top: 6px;
    align-items: center;
    gap: 6px;
  }

  .tw-notif-dest-lbl {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
  }

  .tw-notif-p0-actions {
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    border-top: 1px solid rgba(51, 51, 51, 0.55);
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
  }

  .tw-notif-p0-actions--split {
    justify-content: space-between;
  }

  .tw-notif-p0-form {
    margin: 0;
  }

  .tw-notif-p0-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 10px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 0;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-secondary);
    cursor: pointer;
  }

  .tw-notif-p0-btn--primary {
    border-color: rgba(39, 150, 242, 0.45);
    background: rgba(39, 150, 242, 0.14);
    color: var(--primary);
  }

  .tw-notif-p0-btn--ghost {
    border-color: rgba(39, 150, 242, 0.25);
    color: var(--text-primary);
  }

  .tw-notif-p0-btn--muted {
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.55);
  }

  .tw-notif-p0-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--primary);
    border-top: 1px solid rgba(51, 51, 51, 0.55);
    background: rgba(0, 0, 0, 0.15);
  }

  /* Primär: serverklass; sekundär: :has om kortklass saknas */
  .tw-notif-card.is-unread-card,
  .tw-notif-card:has(.tw-notif-item.is-unread) {
    box-shadow: inset 2px 0 0 0 rgba(39, 150, 242, 0.75);
  }

  .tw-notif-empty--p0 {
    padding: 28px 14px;
  }
}

@media (min-width: 769px) {
  /* Explicit layout utan display:contents på länk (säkrare klickyta / webbläsare) */
  .tw-notif-item--has-hit {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 10px;
  }

  .tw-notif-item--has-hit .tw-notif-item-hit {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
    padding: 0;
    margin: 0;
    text-decoration: none;
    color: inherit;
  }

  .tw-notif-item--has-hit .tw-notif-actions {
    margin-top: 4px;
    padding: 0;
    width: 100%;
  }

  .tw-notif-item--has-hit .tw-notif-p0-banner {
    display: none;
  }
}

/* Zebra: one .tw-notif-item per article — alternate by article index */
.tw-notif-list--p0 .tw-notif-item:nth-child(even) {
  background: transparent;
}

.tw-notif-list--p0 > article:nth-child(even) .tw-notif-item--shell,
.tw-notif-list--p0 > article:nth-child(even) a.tw-notif-item--shell {
  background: var(--surface-3);
}

@media (max-width: 768px) {
  .tw-notif-list--p0 > article:nth-child(even) .tw-notif-item--shell,
  .tw-notif-list--p0 > article:nth-child(even) a.tw-notif-item--shell {
    background: transparent;
  }
}

/* Actor-avatar med typ-ikon-badge (vem + vad) */
.tw-notif-icon--avatar {
  position: relative;
  overflow: visible;
  background: transparent;
  border: 0;
  padding: 0;
}
.tw-notif-avatar-img {
  width: 100%;
  height: 100%;
  min-width: 28px;
  min-height: 28px;
  object-fit: cover;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--surface-3);
  display: block;
}
.tw-notif-avatar-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--surface-2);
  font-size: 7px;
  line-height: 1;
}

/* "Markera alla lästa"-knapp i hero */
.tw-notif-markall {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface-4);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 0;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
}
.tw-notif-markall:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tw-notif-markall:disabled { opacity: 0.5; cursor: default; }
.tw-notif-markall i { font-size: 10px; }
