/* ========================================================= NOTIFICATIONS == */
/* Notification center (task queue #22): the top 3 in the home column, a bell
   in the rail, and the full menu as a panel from the right. Own file, same
   reason as home.css. One color per type, used for the icon tile only, so a
   list of mixed types still reads calm. Amber stays "needs you", red stays
   "failing", as in style.css. */

:root {
  --nt-done: var(--ok);
  --nt-question: var(--warn);
  --nt-failed: var(--danger);
  --nt-alert: #ff9f5a;
  --nt-usage: #5eaaff;
  --nt-calendar: var(--teal);
  --nt-info: var(--text-2);
  --nd-w: 440px;
}
.nt-done { --nt: var(--nt-done); }
.nt-question { --nt: var(--nt-question); }
.nt-failed { --nt: var(--nt-failed); }
.nt-alert { --nt: var(--nt-alert); }
.nt-usage { --nt: var(--nt-usage); }
.nt-calendar { --nt: var(--nt-calendar); }
.nt-info { --nt: var(--nt-info); }

/* The type mark: a small tinted tile with the type's icon. */
.nt-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--nt, var(--text-2));
  background: color-mix(in srgb, var(--nt, var(--text-2)) 13%, transparent);
}
.nt-icon .ic { width: 15px; height: 15px; }

/* ---- the rail bell ---- */
#notif-btn { position: relative; }
.notif-badge {
  display: none;
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #0b0b12;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 650;
  line-height: 15px;
  text-align: center;
}
#notif-btn.has-unread .notif-badge { display: block; }
#notif-btn.has-urgent .notif-badge { background: var(--warn); box-shadow: 0 0 10px rgba(245, 182, 74, 0.55); }
#notif-btn.has-unread { color: var(--text); }

/* ---- home column: the top 3, above usage ---- */
#home-notifs {
  display: grid;
  gap: 4px;
  padding: 9px 8px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.hn-head { display: flex; align-items: center; gap: 7px; height: 22px; padding: 0 5px 0 6px; color: var(--text-3); }
.hn-head > .ic { width: 14px; height: 14px; }
.hn-count { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3); }
.hn-count.unread { color: var(--accent-2); }
.hn-count.urgent { color: var(--warn); }
.hn-all {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  height: 22px;
  padding: 0 6px 0 8px;
  border-radius: 7px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.14s var(--ease), background 0.14s var(--ease);
}
.hn-all .ic { width: 12px; height: 12px; }
.hn-all:hover { color: var(--text); background: var(--surface-2); }
#home-notifs-list { display: grid; gap: 2px; }
#home-notifs-list:empty::after { content: 'Nothing yet.'; padding: 6px; font-size: var(--fs-xs); color: var(--text-3); }

/* A row: used in the home column and in the menu. */
.nt-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 7px 8px 7px 6px;
  border-radius: 10px;
  text-align: left;
  transition: background 0.14s var(--ease);
}
.nt-row:hover, .nt-row:focus-visible { background: var(--surface-2); outline: none; }
.nt-row.sel { background: var(--surface-3); }
.nt-main { flex: 1; min-width: 0; }
.nt-title {
  font-size: var(--fs-sm);
  line-height: 1.38;
  color: var(--text-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.nt-row.unread .nt-title { color: var(--text); font-weight: 520; }
.nt-meta { display: flex; gap: 6px; margin-top: 2px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.nt-meta .nt-thread { overflow: hidden; text-overflow: ellipsis; }
.nt-code { color: var(--text-3); }
.nt-dot { flex: none; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%; background: transparent; }
.nt-row.unread .nt-dot { background: var(--accent); }
.nt-row.unread.urgent .nt-dot { background: var(--warn); box-shadow: 0 0 8px rgba(245, 182, 74, 0.6); }
.nt-row.unread.urgent::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: var(--nt, var(--warn));
}
.nt-row.fresh { animation: ntIn 0.42s var(--ease-spring) both; }
@keyframes ntIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---- the menu ---- */
#notif-drawer { position: fixed; inset: 0; z-index: 95; }
#notif-drawer.hidden { display: none; }
.nd-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.42); animation: fadeIn 0.18s var(--ease) both; }
.nd-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(var(--nd-w), 100vw);
  background: var(--bg-2);
  border-left: 1px solid var(--line-2);
  box-shadow: -24px 0 64px -20px rgba(0, 0, 0, 0.7);
  animation: ndIn 0.26s var(--ease) both;
}
@keyframes ndIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.nd-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 18px; }
.nd-title { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.nd-unread { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3); }
.nd-unread.unread { color: var(--accent-2); }
#nd-read-all { margin-left: auto; height: 28px; font-size: var(--fs-xs); }
#nd-read-all:disabled { opacity: 0.4; pointer-events: none; }
.nd-filters { display: flex; gap: 6px; padding: 2px 18px 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.nd-filters .filter-btn { flex: none; height: 26px; padding: 0 10px; white-space: nowrap; }
.nd-filters .filter-btn .nd-n { margin-left: 5px; font-family: var(--mono); font-size: 10px; color: var(--accent-2); }
.nd-body { position: relative; flex: 1; min-height: 0; }
#nd-list { height: 100%; overflow-y: auto; padding: 6px 10px 20px; }
.nd-day { padding: 12px 8px 4px; font-size: 10.5px; font-weight: 560; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.nd-more { display: block; margin: 12px auto 0; height: 28px; font-size: var(--fs-xs); }
.nd-empty { padding: 32px 12px; text-align: center; font-size: var(--fs-sm); color: var(--text-3); }

/* One notification, in full, in place of the list. */
#nd-detail {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 12px 20px 28px;
  background: var(--bg-2);
  animation: panelIn 0.2s var(--ease) both;
}
#nd-detail.hidden { display: none; }
.ndd-top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.ndd-back { height: 28px; padding-left: 6px; }
.ndd-top .ops-when { margin-left: auto; }
.ndd-badge { display: inline-flex; align-items: center; gap: 7px; }
.ndd-badge .nt-icon { width: 24px; height: 24px; }
.ndd-type { font-size: var(--fs-xs); font-weight: 560; color: var(--nt, var(--text-2)); }
.ndd-code {
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--text-2);
  transition: color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.ndd-code:hover { color: var(--text); border-color: var(--line-3); }
.ndd-code.copied { color: var(--ok); border-color: rgba(74, 222, 128, 0.4); }
.ndd-title { margin: 0 0 6px; font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.ndd-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 16px; font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3); }
.ndd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.ndd-actions .chip-btn { height: 30px; }
.ndd-actions .ndd-ref { color: var(--accent-2); border-color: var(--accent-line); background: var(--accent-soft); }
.ndd-actions .ndd-ref:hover { color: var(--text); }
.ndd-body { font-size: var(--fs); line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.ndd-body pre { overflow-x: auto; }
.ndd-attach { margin-bottom: 14px; }
.ndd-attach img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }

/* @N12 inside a chat bubble or a report: a link to that notification. */
.notif-ref {
  display: inline;
  padding: 0 4px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--accent-2);
  background: var(--accent-soft);
  cursor: pointer;
}
.notif-ref:hover { color: var(--text); }

@media (max-width: 760px) {
  .nd-panel { width: 100vw; border-left: 0; }
  .notif-badge { top: 4px; right: 3px; }
}
#notif-btn[hidden], #home-notifs[hidden] { display: none; }
