/* Notifications calendar. FullCalendar is skinned with Helix tokens so the
   month, week, day, and agenda views sit in the same shell as the rest of the app. */

.nt-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 0;
  padding: var(--space-4) var(--page-gutter) var(--space-4);
  box-sizing: border-box;
}

/* 1024×700 is the smallest window we keep on one screen. The header stays put
   and the calendar fills whatever is left. Shorter or narrower viewports
   scroll the page instead of crushing the grid. */
@media (min-width: 1024px) and (min-height: 700px) {
  body.nt-events {
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.nt-events > header {
    flex-shrink: 0;
  }

  body.nt-events .nt-page {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }
}

.nt-page .page-header-row {
  align-items: flex-start;
  margin-bottom: 0;
  flex-shrink: 0;
}

.nt-error-banner {
  margin: 0;
  color: var(--danger);
  font-size: var(--font-size-sm);
}

.nt-intro {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  max-width: 42rem;
}

.nt-calendar {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  --fc-border-color: var(--border);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: var(--surface-2);
  --fc-neutral-text-color: var(--text-muted);
  --fc-button-text-color: var(--text);
  --fc-button-bg-color: var(--surface-2);
  --fc-button-border-color: var(--border);
  --fc-button-hover-bg-color: var(--surface-hover);
  --fc-button-hover-border-color: var(--border-strong);
  --fc-button-active-bg-color: var(--action);
  --fc-button-active-border-color: var(--action);
  --fc-button-active-text-color: #fff;
  --fc-event-bg-color: var(--action);
  --fc-event-border-color: var(--action);
  --fc-event-text-color: #fff;
  --fc-today-bg-color: rgba(var(--action-rgb), 0.12);
  --fc-now-indicator-color: var(--danger);
  --fc-list-event-hover-bg-color: var(--surface-2);
  --fc-highlight-color: rgba(var(--action-rgb), 0.16);
  --fc-more-link-text-color: var(--action);
  --fc-non-business-color: var(--surface-2);
  --fc-small-font-size: var(--font-size-xs);
  color: var(--text);
  font-family: inherit;
}

.nt-calendar .fc {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  font-family: inherit;
}

.nt-calendar .fc .fc-toolbar-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text);
}

.nt-calendar .fc .fc-button {
  text-transform: none;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
  box-shadow: none;
  line-height: var(--line-height-tight);
}

.nt-calendar .fc .fc-button:focus {
  box-shadow: var(--focus-ring);
}

.nt-calendar .fc .fc-col-header-cell-cushion,
.nt-calendar .fc .fc-daygrid-day-number,
.nt-calendar .fc .fc-list-day-text,
.nt-calendar .fc .fc-list-day-side-text {
  color: var(--text);
  text-decoration: none;
}

.nt-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  flex-shrink: 0;
}

.nt-filter-menu {
  position: relative;
}

.nt-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 18rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  font: inherit;
  font-size: var(--font-size-sm);
}

.nt-filter-summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nt-filter-caret {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.nt-filter-panel {
  position: fixed;
  z-index: 40;
  min-width: 14rem;
  max-height: 18rem;
  overflow: auto;
  padding: var(--space-2);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.nt-filter-actions {
  display: flex;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.nt-filter-actions button {
  border: 0;
  background: transparent;
  color: var(--action);
  cursor: pointer;
  font: inherit;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  padding: 0;
}

.nt-filter-actions button:disabled {
  color: var(--text-muted);
  cursor: default;
}

.nt-filter-choice {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.1rem;
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.nt-filter-choice input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--action);
}

.nt-filter-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.nt-calendar .fc .fc-list-event td {
  background: transparent;
  color: inherit;
}

.nt-calendar .fc-event.nt-status-completed,
.nt-calendar .fc-event.nt-status-resolved {
  opacity: 0.72;
}

.nt-calendar .fc-event.nt-status-canceled,
.nt-calendar .fc-event.nt-status-canceled .fc-event-time,
.nt-calendar .fc-event.nt-status-canceled .fc-event-title,
.nt-calendar .fc-list-event.nt-status-canceled .fc-list-event-time,
.nt-calendar .fc-list-event.nt-status-canceled .fc-list-event-title {
  text-decoration: line-through;
}

.nt-calendar .fc-event.nt-status-failed {
  box-shadow: inset 0 0 0 2px var(--danger);
}

.nt-calendar .fc-event.nt-unread {
  box-shadow: inset 3px 0 0 #fff;
}

.nt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.nt-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
}

.nt-meta {
  margin: 0 0 var(--space-2);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.nt-body {
  margin: var(--space-3) 0 0;
  white-space: pre-wrap;
  color: var(--text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.nt-when {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.nt-when[hidden] {
  display: none;
}

.nt-products {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.nt-product {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--text);
}

.nt-feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

#nt-form .modal-field-label,
#nt-feed-overlay .modal-field-label {
  display: block;
  margin-top: var(--space-3);
}

#nt-feed-overlay .modal-field-label[hidden],
#nt-feed-overlay #nt-feed-url[hidden],
#nt-feed-overlay .nt-feed-actions button[hidden] {
  display: none;
}

@media (max-width: 720px) {
  .nt-page {
    height: auto;
    min-height: calc(100dvh - 4.5rem);
  }

  .nt-page .page-header-row {
    flex-direction: column;
  }

  .nt-page .page-header-actions {
    margin-left: 0;
  }

  .nt-when {
    grid-template-columns: 1fr;
  }

  .nt-calendar {
    min-height: 36rem;
  }
}

@media (max-width: 1023px), (max-height: 699px) {
  .nt-calendar {
    min-height: 36rem;
  }
}

.nt-prefs-page {
  max-width: 56rem;
}

/* Timezone: label and help on the left, the picker on the right. */
.nt-pref-zone {
  display: grid;
  grid-template-columns: 1fr minmax(14rem, 20rem);
  align-items: center;
  gap: var(--space-4);
}

/* display:grid outranks the browser's [hidden] rule. */
#nt-desktop-toast[hidden] {
  display: none !important;
}

.nt-pref-zone .nt-pref-copy {
  margin: var(--space-1) 0 0;
}

.nt-pref-zone-label {
  font-weight: 700;
}

/* One row per kind of email, one column per cadence. */
.nt-matrix-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  background: var(--surface);
  margin-bottom: var(--space-4);
}

.nt-matrix {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* The site's table headers are sortable column labels (capitals, no wrap, pointer); these are row labels. */
.nt-matrix th {
  white-space: normal;
  text-transform: none;
  letter-spacing: normal;
  cursor: default;
  user-select: auto;
  font-size: inherit;
  color: inherit;
  border-bottom: 0;
}

.nt-matrix th:hover {
  background: transparent;
  color: inherit;
}

.nt-matrix col.nt-matrix-col-cadence,
.nt-matrix thead th:not(:first-child) {
  width: 7.5rem;
}

.nt-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--space-3);
  font-size: var(--font-size-sm, 0.85rem);
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.nt-matrix thead th:first-child {
  text-align: left;
}

/* Each group is a band: its own background and a stronger rule above, so the rows under it read as one section. */
.nt-matrix-group th {
  padding: var(--space-3);
  text-align: left;
  background: var(--surface-2);
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.nt-matrix-group:first-child th {
  border-top: 0;
}

.nt-matrix-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}

.nt-matrix-group-name {
  font-size: var(--font-size-sm, 0.85rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.nt-matrix-quick {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

/* The first row under a band needs no rule of its own. */
.nt-matrix-group + .nt-matrix-row th,
.nt-matrix-group + .nt-matrix-row td {
  border-top: 0;
}

.nt-quick-btn {
  padding: 2px var(--space-2);
  font: inherit;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
}

.nt-quick-btn:hover,
.nt-quick-btn:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.nt-prefs-summary {
  margin: 0 0 var(--space-3);
  font-weight: 500;
}

.nt-matrix-row th,
.nt-matrix-row td {
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border);
}

.nt-matrix-row:hover {
  background: var(--surface-hover);
}

.nt-matrix-row th {
  text-align: left;
  font-weight: 400;
}

.nt-matrix-label {
  display: block;
  font-weight: 600;
}

.nt-matrix-copy {
  display: block;
  font-size: var(--font-size-sm, 0.85rem);
  color: var(--text-muted);
}

.nt-matrix-row td {
  text-align: center;
}

.nt-matrix-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.25rem;
  cursor: pointer;
}

.nt-matrix-cell input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.nt-matrix-cell-name {
  display: none;
}

/* Save stays in reach on a long page. */
.nt-pref-actions--sticky {
  position: sticky;
  bottom: 0;
  padding: var(--space-3) 0;
  background: linear-gradient(to top, var(--bg, var(--surface)) 70%, transparent);
}

/* Phones: each row becomes a label over a three-way switch. */
@media (max-width: 640px) {
  .nt-pref-zone {
    grid-template-columns: 1fr;
  }
  .nt-desktop-toast-actions,
  .nt-desktop-toast-actions .nt-meta {
    align-items: flex-start;
    justify-self: start;
    text-align: left;
  }
  .nt-matrix thead {
    display: none;
  }
  .nt-matrix-group,
  .nt-matrix-group th {
    display: block;
  }
  .nt-matrix-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border);
  }
  .nt-matrix-row[hidden] {
    display: none;
  }
  .nt-matrix-row th {
    grid-column: 1 / -1;
    padding: 0 0 var(--space-1);
    border: 0;
  }
  .nt-matrix-row td {
    width: auto;
    padding: 0;
    border: 0;
  }
  .nt-matrix-cell {
    gap: var(--space-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    font-size: var(--font-size-sm, 0.85rem);
  }
  .nt-matrix-cell:has(input:checked) {
    border-color: var(--accent);
    background: var(--surface-2);
  }
  .nt-matrix-cell-name {
    display: inline;
  }
}

.nt-pref {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  background: var(--surface);
}

.nt-pref legend {
  font-weight: 700;
  padding: 0 0.25rem;
}

.nt-pref-copy {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.nt-pref-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
}

.nt-pref-choices label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.nt-pref-timezone {
  display: block;
  width: 100%;
  max-width: 28rem;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  padding: 0.45rem 0.6rem;
}

.nt-pref-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nt-desktop-toast-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  justify-self: end;
}

.nt-desktop-toast-actions .nt-meta {
  margin: 0;
  max-width: 16rem;
  text-align: right;
}
