/* Intent (S7): the room (dashboard-intent.js, every selector under .it-room)
   and the watch editor drawer (nexus-watch-editor.js, under .nx-watch).
   Tokens only. Labels stay in normal case with no tracking; each count sits
   in its own mono chip. Every control is at least 32 px high, and every field
   draws its edge in --net-field-edge so it holds 3:1 against its surface. */

.it-room {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1440px;
  min-width: 0;
}
.it-room .btn {
  min-height: 32px;
}
.it-room a:focus-visible,
.it-room button:focus-visible,
.it-room select:focus-visible,
.it-room input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.it-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.it-head-text {
  display: flex;
  flex: 1 1 320px;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.it-title {
  margin: 0;
  color: var(--text-1);
  font-size: 24px;
  font-weight: 300;
  line-height: 1.25;
}
.it-sub {
  max-width: 68ch;
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
}
.it-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.it-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

/* ── The left panel ──────────────────────────────────────────────── */
.it-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.it-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.it-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  color: var(--text-2);
  font-size: 14px;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.it-nav-link:hover {
  color: var(--text-1);
  background: var(--bg-2);
}
.it-nav-link[aria-current="page"] {
  color: var(--text-1);
  background: var(--bg-2);
  box-shadow: inset 2px 0 0 var(--focus-ring);
}
.it-nav-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
.it-left-head {
  margin: 16px 0 4px;
  padding: 0 12px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}
.it-count,
.it-mono {
  font-family: var(--font-mono);
  font-size: 13px;
}
.it-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0 8px;
  color: var(--text-1);
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

/* ── The main area ───────────────────────────────────────────────── */
.it-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.it-section-head {
  margin: 16px 0 0;
  color: var(--text-1);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
}
.it-section-head:first-child {
  margin-top: 0;
}
.it-status,
.it-muted,
.it-hint {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
}
.it-hint {
  font-size: 13px;
}
.it-notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.it-notice-text {
  max-width: 68ch;
  margin: 0;
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
}
.it-reasons {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0 0 0 16px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
}
.it-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.it-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.it-field-label {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.4;
}
.it-select,
.it-input {
  min-height: 36px;
  min-width: 0;
  padding: 0 12px;
  color: var(--text-1);
  font: inherit;
  font-size: 14px;
  background: var(--bg-2);
  border: 1px solid var(--net-field-edge);
  border-radius: var(--radius-sm);
}
.it-select {
  max-width: 100%;
}
/* A link never wraps: a long name ends in an ellipsis and keeps its title. */
.it-link {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.it-link:hover {
  color: var(--text-1);
}

/* Matches: rows on the left, Details beside them (below them on a phone). */
.it-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.it-split:has(.it-details:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
}
.it-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.it-rows {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.it-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 1.2fr) 84px auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 12px;
  border-top: 1px solid var(--border);
}
.it-row:first-child {
  border-top: 0;
}
.it-row[aria-current="true"] {
  background: var(--bg-2);
  box-shadow: inset 2px 0 0 var(--focus-ring);
}
.it-time {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
}
.it-row-subject {
  min-width: 0;
}
.it-source {
  color: var(--text-2);
  font-size: 14px;
}
.it-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.it-pill,
.it-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 0 8px;
  overflow: hidden;
  color: var(--text-1);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.it-pill-more {
  font-family: var(--font-mono);
}
.it-state {
  color: var(--text-2);
  font-size: 14px;
}
.it-state-new {
  color: var(--text-1);
  font-weight: 500;
}
.it-row-open {
  justify-self: end;
}
.it-more {
  align-self: flex-start;
}
.it-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}
.it-details[hidden] {
  display: none;
}
.it-details-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.it-details-title {
  margin: 0;
  color: var(--text-1);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.it-fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}
.it-fields dt {
  color: var(--text-2);
}
.it-fields dd {
  min-width: 0;
  margin: 0;
  color: var(--text-1);
  overflow-wrap: anywhere;
}
.it-reasons-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.it-reasons-pick[hidden] {
  display: none;
}

/* Watches: the templates, a watch's card, and the table. */
.it-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
}
.it-template,
.it-card,
.it-channel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.it-template[data-disabled="true"] {
  background: var(--bg-0);
  border-style: dashed;
  border-color: var(--border-strong);
}
.it-template-title,
.it-card-title,
.it-channel-name {
  margin: 0;
  color: var(--text-1);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}
.it-card-title {
  font-size: 18px;
  font-weight: 400;
}
.it-template .btn,
.it-card .btn {
  margin-top: 4px;
}
.it-template-state {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  font-size: 14px;
}
.it-wait {
  margin: 0;
  color: var(--status-warn);
  font-size: 14px;
  line-height: 1.5;
}
.it-quota {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}
.it-watch-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-1);
  white-space: nowrap;
}
.it-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
}
.it-dot-active {
  background: var(--status-ok);
}
.it-dot-blocked {
  background: var(--status-bad);
}
.it-dot-paused {
  background: var(--status-warn);
}
.it-tablebox {
  max-width: 100%;
  overflow-x: auto;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.it-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.it-table th,
.it-table td {
  padding: 12px 12px;
  color: var(--text-1);
  text-align: left;
  vertical-align: middle;
  border-top: 1px solid var(--border);
}
.it-table th {
  color: var(--text-2);
  font-weight: 400;
  border-top: 0;
  white-space: nowrap;
}
.it-table tr[aria-current="true"] td {
  background: var(--bg-2);
}
.it-num {
  font-family: var(--font-mono);
  text-align: right;
}
.it-table th.it-num {
  font-family: inherit;
}
.it-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.it-coverage {
  white-space: nowrap;
}
.it-coverage-waiting_for_source,
.it-coverage-partial {
  color: var(--status-warn);
}
.it-coverage-failed {
  color: var(--status-bad);
}

/* Delivery: the channels and the recipient's settings. */
.it-channels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.it-channel-state {
  margin: 0;
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
}
.it-tone-ok {
  color: var(--status-ok);
}
.it-tone-warn {
  color: var(--status-warn);
}
.it-tone-muted {
  color: var(--text-2);
}
.it-approvals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.it-approval {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-1);
  font-size: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.it-form {
  align-items: stretch;
  gap: 16px;
  max-width: 560px;
}
.it-form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.it-form-check {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  color: var(--text-1);
  font-size: 14px;
}
.it-form-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.it-check {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}
.it-error {
  margin: 0;
  color: var(--status-bad);
  font-size: 14px;
}
.it-error[hidden] {
  display: none;
}

@media (max-width: 1100px) {
  .it-split:has(.it-details:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
  .it-row {
    grid-template-columns: 112px minmax(0, 1fr) auto;
  }
  .it-row .it-source,
  .it-row .it-pills {
    grid-column: 2 / 3;
  }
}
@media (max-width: 760px) {
  .it-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .it-head {
    padding: 12px;
  }
  .it-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .it-left-head {
    margin-top: 8px;
  }
  .it-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }
  .it-row .it-time,
  .it-row .it-row-subject,
  .it-row .it-source,
  .it-row .it-pills {
    grid-column: 1 / -1;
  }
  .it-form-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── The watch editor (nexus-watch-editor.js) ───────────────────────── */
.nx-watch-scrim {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: var(--scrim);
}
.nx-watch {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1201;
  display: flex;
  flex-direction: column;
  width: 520px;
  max-width: 100%;
  color: var(--text-1);
  background: var(--bg-1);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-popover);
}
.nx-watch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.nx-watch-title {
  margin: 0;
  color: var(--text-1);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
}
.nx-watch-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  list-style: none;
  border-bottom: 1px solid var(--border);
}
.nx-watch-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 14px;
}
.nx-watch-step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
}
.nx-watch-step[aria-current="step"] {
  color: var(--text-1);
}
.nx-watch-step[aria-current="step"] .nx-watch-step-n {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.nx-watch-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  overflow-y: auto;
}
.nx-watch-body fieldset {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.nx-watch-body legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--text-1);
  font-size: 15px;
  font-weight: 500;
}
.nx-watch-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 32px;
  padding: 12px 12px;
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.nx-watch-choice[data-disabled="true"] {
  color: var(--text-2);
  background: var(--bg-1);
}
.nx-watch-choice input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 4px 0 0;
  accent-color: var(--accent);
}
.nx-watch-choice-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.nx-watch-note {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}
.nx-watch-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.nx-watch-label {
  color: var(--text-2);
  font-size: 13px;
}
.nx-watch-input {
  min-height: 36px;
  min-width: 0;
  padding: 0 12px;
  color: var(--text-1);
  font: inherit;
  font-size: 14px;
  background: var(--bg-2);
  border: 1px solid var(--net-field-edge);
  border-radius: var(--radius-sm);
}
.nx-watch-input:focus-visible,
.nx-watch button:focus-visible,
.nx-watch a:focus-visible,
.nx-watch input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.nx-watch-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.nx-watch-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.nx-watch-big {
  margin: 0;
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.5;
}
.nx-watch-wait {
  margin: 0;
  color: var(--status-warn);
  font-size: 14px;
  line-height: 1.5;
}
.nx-watch-sample {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nx-watch-sample li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.nx-watch-mono {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 13px;
}
.nx-watch-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.nx-watch-foot .btn,
.nx-watch-head .btn {
  min-height: 32px;
}
.nx-watch-error {
  flex: 1 1 100%;
  margin: 0;
  color: var(--status-bad);
  font-size: 14px;
}
.nx-watch-error[hidden],
.nx-watch [hidden] {
  display: none;
}
