/* ============================================================================
   BridgeIT — the app's own layout, built entirely from Nocturne's tokens.
   No hex values live here: every colour is a token in nocturne.css, so the
   palette is retuned in one place.
   ========================================================================= */

/* ── Shell ───────────────────────────────────────────────────────────────── */
.shell {
  display: flex;
  height: 100vh;
  min-height: 720px;
  overflow: hidden;
}

/* ── Left rail ───────────────────────────────────────────────────────────── */
.rail {
  width: 320px;
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-rail-line);
  background: var(--color-rail);
}

.rail-brand {
  padding: 20px 20px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rail-logo { flex: none; color: var(--color-priority-medium); }

.rail-wordmark {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rail-live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-success);
  background: var(--color-success-soft);
}

.rail-live:has(.is-offline) {
  color: var(--color-error);
  background: var(--color-error-soft);
}

.rail-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
}

.rail-live-dot.is-offline { background: var(--color-error); }

.rail-intro {
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-explainer {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-3);
}

.rail-jql-trigger {
  width: 100%;
  min-height: var(--target);
}

.rail-jql-trigger i { font-size: 17px; }

.rail-search {
  position: relative;
  display: flex;
  align-items: center;
}

.rail-search-icon {
  position: absolute;
  left: 12px;
  font-size: 16px;
  pointer-events: none;
  color: var(--color-text-3);
}

.rail-search-input {
  width: 100%;
  min-height: 42px;
  padding-left: 36px;
  padding-right: 34px;
  font-size: 14px;
  background: var(--color-inset);
  border-color: var(--color-divider);
}

.rail-search-input::-webkit-search-cancel-button { display: none; }

.rail-search-clear {
  position: absolute;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-3);
}

.rail-search-clear:hover { color: var(--color-text); background: var(--color-raised); }

.rail-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 10px;
}

.rail-list-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -10px 6px;
  padding: 10px 20px;
  font-size: 12px;
  color: var(--color-text-3);
  background: var(--color-rail);
  border-top: 1px solid var(--color-rail-line);
  border-bottom: 1px solid var(--color-rail-line);
}

.rail-list-header .label {
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rail-list-count {
  margin-left: auto;
  padding: 1px 9px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-chip);
}

.rail-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail-row-wrap {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.rail-check {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 14px 4px 0 10px;
  cursor: pointer;
}

.rail-check:disabled {
  cursor: default;
  opacity: 0.3;
}

.rail-list-header .rail-check { margin: 0; }

.rail-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  /* min-width:0 keeps the 2-line summary clamp working inside the flex row. */
  flex: 1;
  min-width: 0;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font: inherit;
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
}

.rail-row:hover { background: var(--color-inset); }

.rail-row.is-selected {
  background: var(--color-raised);
  border-color: var(--color-control-border);
}

.rail-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rail-row-priority { font-size: 14px; }

.rail-row-key {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-accent-ink);
}

.rail-row-summary {
  font-size: 13.5px;
  line-height: 1.4;
  text-align: left;
  color: var(--color-text-body);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rail-row.is-selected .rail-row-summary { color: var(--color-text); }

.badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-accent-ink);
  background: var(--color-accent-soft);
}

.badge-needs-update { color: var(--color-warn); background: var(--color-warn-soft); }
.badge-synced { color: var(--color-success); background: var(--color-success-soft); }
.badge-failed { color: var(--color-error); background: var(--color-error-soft); }
.badge-expired { color: var(--color-text-2); background: var(--color-chip); }
.badge-sending { color: var(--color-accent-ink); background: var(--color-accent-soft); }

.rail-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 12px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-lg);
  background: var(--color-raised);
}

.rail-bulk-count {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.rail-bulk-send {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.rail-bulk-clear {
  min-height: 36px;
  padding: 0 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-2);
}

.rail-bulk-clear:hover { color: var(--color-text); background: var(--color-chip); }

.rail-footer {
  border-top: 1px solid var(--color-rail-line);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rail-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text);
  flex-shrink: 0;
  white-space: nowrap;
}

.rail-footer-link i { font-size: 16px; }
.rail-footer-link:hover { background: var(--color-surface); }

.rail-footer-link.is-active {
  color: var(--color-accent-ink);
  background: var(--color-accent-soft);
}

/* A form only because ending a session has to be a POST; it must not add a box of
   its own to the footer's row. */
.rail-sign-out-form { display: contents; }

.rail-sign-out { color: var(--color-text-2); }
.rail-sign-out:hover { color: var(--color-text); }

.rail-status {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--color-text-3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The tracked pages that are up to date, folded away under the rows. */
.rail-tracked {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 30px);
  min-height: 40px;
  margin: 8px 0 4px 30px;
  padding: 0 12px;
  border: 1px dashed var(--color-control-border);
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: left;
  color: var(--color-text-2);
}

.rail-tracked:hover { color: var(--color-text); background: var(--color-inset); }
.rail-tracked i { font-size: 13px; }

.rail-empty { padding: 12px 10px; }

/* ── Main pane ───────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  position: relative;
  background: var(--color-bg);
}

.state-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 40px;
}

.state-panel h2 { margin: 6px 0 0; font-size: 20px; font-weight: 600; }
.state-panel p { margin: 0; font-size: 15px; max-width: 420px; line-height: 1.55; color: var(--color-text-2); }
.state-panel .subline { font-size: 14px; color: var(--color-text-3); }
.state-panel .actions { display: flex; gap: 10px; margin-top: 8px; }

/* Each state's icon sits in a tile, so the four states read as one family. */
.state-panel .icon-muted,
.state-panel .icon-error,
.state-panel .icon-success {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 28px;
}

.state-panel .icon-muted { color: var(--color-text-2); background: var(--color-raised); }
.state-panel .icon-error { color: var(--color-error); background: var(--color-error-soft); }
.state-panel .icon-success { color: var(--color-success); background: var(--color-success-soft); }

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--color-divider);
  border-top-color: var(--color-accent-text);
  animation: spin 0.9s linear infinite;
}

.spinner-inline {
  display: inline-block;
  flex: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--color-control-border);
  border-top-color: var(--color-accent-text);
  animation: spin 0.9s linear infinite;
  vertical-align: -2px;
}

/* ── Preview header ──────────────────────────────────────────────────────── */
.preview-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  padding: 22px 40px 20px;
}

.preview-header-row {
  display: flex;
  align-items: flex-end;
  gap: 16px 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.preview-header-main { flex: 1; min-width: 0; }

.preview-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.preview-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.preview-key i { font-size: 13px; }

.preview-sender {
  font-size: 13px;
  color: var(--color-text-3);
}

.preview-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

.preview-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-actions .btn { min-height: var(--target); }
.preview-actions .btn i { font-size: 17px; }

.preview-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px 40px 72px;
  max-width: 1260px;
  margin: 0 auto;
}

/* ── Banners ─────────────────────────────────────────────────────────────── */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 13px 16px;
  border-radius: var(--radius-lg);
  background: var(--color-accent-soft);
  color: var(--color-text-body);
  font-size: 14px;
  line-height: 1.5;
}

.banner > span { flex: 1 1 320px; }
.banner i { font-size: 19px; color: var(--color-accent-text); }
.banner a { margin-left: auto; font-weight: 600; white-space: nowrap; }

.banner-error {
  color: var(--color-error-ink);
  background: var(--color-error-soft);
}

.banner-error i { color: var(--color-error); }

/* Outside the preview body's flex gap, a banner keeps its own spacing. */
.settings .banner { margin-bottom: 22px; }

/* ── Section cards ───────────────────────────────────────────────────────── */
.section-card {
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.section-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.section-card-head h3 { margin: 0; font-size: 16px; }

.destination {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-2);
  flex-wrap: wrap;
}

.destination-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-chip);
}

.destination-chip i { font-size: 14px; }

.differs-legend {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-warn);
}

.differs-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--color-warn-mark);
}

/* ── Field table ─────────────────────────────────────────────────────────── */
.fields {
  display: grid;
  grid-template-columns: 150px minmax(0, 1.3fr) minmax(0, 1fr) 230px;
  column-gap: 16px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
}

/* Inside its section card the card is the frame. */
.section-card .fields {
  border: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: transparent;
}

.fields-head,
.fields-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
}

.fields-head {
  padding: 10px 20px;
  background: var(--color-inset);
  border-bottom: 1px solid var(--color-divider-soft);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-3);
}

.fields-row {
  align-items: center;
  min-height: 54px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.fields-row:last-child { border-bottom: 0; }

.fields-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

/* Editable in place: a quiet field until you reach for it. */
.fields-value {
  width: 100%;
  min-height: 38px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  caret-color: var(--color-accent-text);
  background: var(--color-raised);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 10px;
}

.fields-value:hover { border-color: var(--color-control-border); }
.fields-value:focus-visible { border-color: var(--color-accent); outline: none; box-shadow: 0 0 0 3px var(--color-accent-ring); }

/* What Notion holds today, beside what a send would write. */
.fields-notion {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-2);
}

/* Not a value: unmapped, untracked, or a type that cannot be compared. */
.fields-notion-none {
  font-size: 13px;
  font-style: italic;
  color: var(--color-text-3);
}

.fields-notion-differs { color: var(--color-warn); font-weight: 500; }

/* The row that is actually driving the "needs update" flag. */
.fields-row-differs { background: var(--color-warn-row); }

.fields .mapping-select { max-width: none; width: 100%; }

/* A field shown for context and never written. */
.fields-row-reference { background: var(--color-inset); }

.fields-row-reference .fields-readonly {
  padding: 0 10px;
  font-size: 14px;
  color: var(--color-text-body);
}

.fields-notsent {
  justify-self: start;
  padding: 2px 9px;
  border: 1px dashed var(--color-control-border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--color-text-3);
}

.fields-target {
  font-size: 13.5px;
  color: var(--color-text-2);
}

.fields-target .type { opacity: 0.6; }

/* The same grid, narrowed to fit inside the confirm dialog. */
.fields.fields-readonly {
  grid-template-columns: minmax(96px, 0.8fr) minmax(0, 1.6fr) minmax(90px, 1fr);
  column-gap: 12px;
}

.fields-readonly .fields-head,
.fields-readonly .fields-row { padding-left: 14px; padding-right: 14px; }

.fields-readonly .fields-row { min-height: 0; padding-top: 9px; padding-bottom: 9px; }
.fields-readonly .fields-label { font-weight: 400; color: var(--color-text-2); }

.fields-value-static {
  font-size: 14px;
  overflow-wrap: anywhere;
  color: var(--color-text);
}

/* Where a child stands in Notion, on its parent's preview — children have no rail row
   of their own, so this is the only place their state shows. */
.child-status {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.child-status-synced { color: var(--color-success); background: var(--color-success-soft); }
.child-status-stale { color: var(--color-warn); background: var(--color-warn-soft); }
.child-status-absent { color: var(--color-text-2); background: var(--color-chip); }

/* ── Page body ───────────────────────────────────────────────────────────── */
.body-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.body-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  font-size: 13.5px;
  color: var(--color-text-2);
}

.body-section-head h3 { margin: 0; font-size: 16px; color: var(--color-text); }

.panel {
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 60px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-divider-soft);
}

/* Kept for anything still asking for the old compact head. */
.panel-head.tight { padding: 12px 20px; }

.head-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.head-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.head-check input[type="checkbox"]:disabled {
  cursor: default;
  opacity: 0.3;
}

.head-check label { cursor: pointer; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0; }

.panel-head h3 .count {
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-2);
  background: var(--color-chip);
}

.panel-target {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--color-text-3);
}

.panel-hint {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--color-text-3);
}

/* Whether this part goes to Notion, said next to the box that decides it. */
.include-pill {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-2);
  background: var(--color-chip);
}

.include-pill.is-on { color: var(--color-success); background: var(--color-success-soft); }

.panel-inner { padding: 6px 20px 10px; }

.panel-foot {
  margin: 0;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--color-divider-soft);
  font-size: 13px;
  color: var(--color-text-2);
}

/* Rich text from Jira, in the description and in every comment. It arrives as
   Jira's rendered HTML, so the rules cover what that HTML actually contains:
   headings, lists, code panels, tables and quotes. */
.description,
.comment-body {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--color-text-body);
  overflow-wrap: anywhere;
}

.description {
  padding: 20px 28px 12px;
  outline: none;
}

.description:focus-visible {
  outline: 2px solid var(--color-accent-text);
  outline-offset: -2px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.description :is(h1, h2, h3, h4, h5, h6),
.comment-body :is(h1, h2, h3, h4, h5, h6) {
  margin: 22px 0 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.4;
  color: var(--color-text);
  text-transform: none;
}

.description :is(h1, h2, h3, h4, h5, h6):first-child,
.comment-body :is(h1, h2, h3, h4, h5, h6):first-child { margin-top: 0; }

.description p,
.comment-body p { margin: 0 0 12px; }

.description :is(ol, ul),
.comment-body :is(ol, ul) { margin: 0 0 12px; padding-left: 24px; }

.description li,
.comment-body li { margin: 3px 0; }

.description strong,
.comment-body strong { color: var(--color-text); }

.description code,
.comment-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 1px 5px;
  border: 1px solid var(--color-divider);
  border-radius: 5px;
  background: var(--color-raised);
}

.description pre,
.comment-body pre {
  margin: 0 0 14px;
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre;
  overflow-wrap: normal;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-body);
  background: var(--color-code);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}

.description pre code,
.comment-body pre code { padding: 0; border: 0; background: none; font-size: inherit; }

.description blockquote,
.comment-body blockquote {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text-2);
  background: var(--color-raised);
}

.description table,
.comment-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: 0 0 14px;
  border-collapse: collapse;
  font-size: 14px;
}

.description :is(th, td),
.comment-body :is(th, td) {
  padding: 7px 10px;
  border: 1px solid var(--color-divider);
  text-align: left;
  vertical-align: top;
}

.description th,
.comment-body th { font-weight: 600; background: var(--color-inset); }

.description img,
.comment-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

.description hr,
.comment-body hr { height: 1px; margin: 18px 0; border: 0; background: var(--color-divider); }

/* Comments, newest first, five at a time. */
.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comment {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-divider-soft);
}

.comment:last-child { border-bottom: 0; }

.comment-avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.comment-avatar-1 { color: var(--color-avatar-1-fg); background: var(--color-avatar-1-bg); }
.comment-avatar-2 { color: var(--color-avatar-2-fg); background: var(--color-avatar-2-bg); }
.comment-avatar-3 { color: var(--color-avatar-3-fg); background: var(--color-avatar-3-bg); }
.comment-avatar-4 { color: var(--color-avatar-4-fg); background: var(--color-avatar-4-bg); }

.comment-main { flex: 1; min-width: 0; }

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-bottom: 4px;
}

.comment-author { font-size: 14px; font-weight: 600; color: var(--color-text); }
.comment-date { font-size: 12.5px; color: var(--color-text-3); }
.comment-body { font-size: 15px; }
.comment-body > :last-child { margin-bottom: 0; }

.comment-empty {
  margin: 0;
  padding: 10px 0 6px;
  font-size: 14px;
  color: var(--color-text-3);
}

.comment-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 4px 20px 18px;
}

.comment-more .btn { min-height: 42px; }

.comment-more-count { font-size: 13px; color: var(--color-text-3); }

/* Held back from Notion: still readable, visibly not going anywhere. */
.description.is-excluded,
.panel-inner.is-excluded { opacity: 0.45; }

.two-up {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
  align-items: start;
}

/* Kept for markup that still stacks panels in one column. */
.two-up-stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.line-list {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.line-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--target);
}

.line-item-check {
  margin: 0 -10px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.line-item-check:hover { background: var(--color-inset); }

.line-item input[type="checkbox"] {
  flex: none;
  width: 17px;
  height: 17px;
  margin: 0;
  cursor: pointer;
}

.line-item i { font-size: 17px; color: var(--color-text-3); }
.line-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.line-item .size { margin-left: auto; font-size: 12.5px; color: var(--color-text-3); white-space: nowrap; }
.line-note { padding: 10px 0; }

.link-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-divider-soft);
}

.link-item:last-of-type { border-bottom: 0; }

.link-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-item-top i { font-size: 15px; color: var(--color-text-3); }

.link-key {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
}

.link-title {
  padding-left: 23px;
  font-size: 13.5px;
  color: var(--color-text-body);
}

.child-content {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--color-text);
  cursor: pointer;
}

.child-content input[type="checkbox"] {
  flex: none;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  cursor: pointer;
}

.child-content-note {
  display: block;
  margin: 6px 0 0 27px;
  font-size: 12.5px;
}

/* ── Unmapped disclosure ─────────────────────────────────────────────────── */
.unmapped {
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.unmapped-toggle {
  width: 100%;
  min-height: 54px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 20px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--color-text);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
}

.unmapped-toggle:hover { background: var(--color-inset); }
.unmapped-toggle i { font-size: 14px; color: var(--color-text-3); }
.unmapped-toggle .count { font-weight: 400; color: var(--color-text-2); }
.unmapped-toggle .hint { margin-left: auto; font-size: 12.5px; font-weight: 400; color: var(--color-text-3); }

.unmapped .panel-inner { padding-top: 0; }

.unmapped-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--color-divider-soft);
  font-size: 14px;
}

.unmapped-row .label {
  width: 150px;
  flex: 0 0 150px;
  font-weight: 500;
}

.unmapped-row .value {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--color-text-2);
}

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 40px 72px;
}

.settings-kicker {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}

.settings h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -0.02em; }

.settings-lede {
  margin: 0 0 28px;
  max-width: 64ch;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--color-text-2);
}

/* The section list beside the one section showing. */
.settings-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 28px;
}

.settings-nav {
  flex: 1 1 190px;
  max-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--target);
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  color: var(--color-text-2);
  cursor: pointer;
}

.settings-tab i { font-size: 17px; }
.settings-tab:hover { color: var(--color-text); background: var(--color-surface); }

.settings-tab.is-active {
  font-weight: 600;
  color: var(--color-accent-ink);
  background: var(--color-accent-soft);
}

.settings-sections {
  flex: 999 1 600px;
  min-width: 0;
}

.settings-card { padding: 22px 24px 4px; }
.settings-card h3 { margin: 0 0 16px; font-size: 18px; }

.settings-group {
  margin: 22px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--color-divider-soft);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-3);
}

.settings-card h3 + .settings-group { margin-top: 0; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px 20px;
}

.field-wide { grid-column: 1 / -1; }

/* Each automatic choice is a row: the explanation and what is in effect on the
   left, the select on the right. */
.settings-rows {
  margin-top: 18px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}

.settings-rows > .field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 1fr);
  grid-template-areas:
    "label select"
    "hint  select";
  align-items: start;
  gap: 6px 20px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.settings-rows > .field:last-child { border-bottom: 0; }
.settings-rows > .field > label { grid-area: label; margin: 0; }
.settings-rows > .field > .input { grid-area: select; }
.settings-rows > .field > .field-hint { grid-area: hint; }

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--color-inset);
}

.preset-lede {
  flex: 1 1 240px;
  font-size: 13.5px;
  color: var(--color-text-2);
}

.preset-export[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.4;
}

/* The file input is the label's own hit area, so it is hidden rather than removed. */
.preset-import {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.preset-import input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.preset-result {
  margin: 12px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--color-text-2);
}

.field-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
}

.field-check input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
}

.field-check label {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.field-check .field-hint { font-weight: 400; }

/* What is actually in effect. Neutral on purpose: the same slot says "matching on
   Jira key" and "choose a database first", and a colour would have to guess which. */
.field-state {
  display: block;
  width: fit-content;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-chip);
}

.field-hint {
  display: block;
  margin: 6px 0 0;
  max-width: 68ch;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-3);
}

.mapping-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin-bottom: 6px;
}

.mapping-head h3 { margin: 0; }
.mapping-db { font-size: 13.5px; color: var(--color-text-3); }

.mapping-lede {
  margin: 0 0 16px;
  max-width: 72ch;
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text-2);
}

.mapping-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.mapping-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-3);
  background: var(--color-inset);
  border-bottom: 1px solid var(--color-divider-soft);
}

.mapping-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.mapping-table tbody tr:last-child td { border-bottom: 0; }

.mapping-table td:first-child { font-weight: 500; }

.mapping-table td.arrow {
  width: 40px;
  text-align: center;
  color: var(--color-text-3);
}

.mapping-table td.target { padding-top: 6px; padding-bottom: 6px; }

/* The watch table reuses .mapping-table; only the columns it adds are new. */
.mapping-table td.watch-remove {
  width: 56px;
  text-align: right;
}

.mapping-table td.watch-remove .btn-ghost {
  width: 40px;
  height: 40px;
  color: var(--color-text-3);
}

.mapping-table td.watch-remove .btn-ghost:hover { color: var(--color-text); }

.mapping-table td.watch-status {
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-2);
}

/* The picker reuses .filter-list / .filter-row from the search dialog, so adding a
   watch looks and narrows exactly like finding an issue does. */
.watch-picker {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watch-picker .filter-list {
  max-height: 320px;
  overflow-y: auto;
}

.mapping-select {
  min-height: 38px;
  padding: 0 8px;
  font-size: 13.5px;
  max-width: 320px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin: 22px -24px 0;
  padding: 16px 24px;
  border-top: 1px solid var(--color-divider-soft);
  background: var(--color-inset);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* The pending-write buttons sit above the cards, not at the foot of one. */
.settings > .settings-actions {
  justify-content: flex-start;
  margin: 0 0 22px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
}

/* A section that ends in a list, not in a save, still closes its card neatly. */
.watch-picker + .settings-actions,
.mapping-table + .settings-actions { margin-top: 18px; }

/* The backup passphrases sit in the same row as their button, so the label wraps the
   input rather than sitting in a settings-grid cell — .field's "> label" rule cannot
   reach a label that is itself the field. */
.backup-field {
  flex: 1 1 260px;
  display: block;
  min-width: 0;
}

.backup-field > span {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--color-text-2);
}

.settings-card .banner {
  margin: 0 0 4px;
  color: var(--color-text-body);
  background: var(--color-raised);
}

.settings-card .banner i { color: var(--color-warn); }

/* ── Search dialog ───────────────────────────────────────────────────────── */
/* The baseline is a shadow, not a border: the strip scrolls sideways on a phone, and a
   scrolling box clips the -1px overlap a border-based active tab would need, which
   then showed a vertical scrollbar for one pixel of tab. */
.search-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  box-shadow: inset 0 -1px 0 var(--color-divider);
  overflow-x: auto;
  overflow-y: hidden;
}

/* Self-sufficient rather than a .btn modifier: nothing composes these with a
   base button class, so the reset has to live here or the browser's native
   chrome shows through. */
.search-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--target);
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--color-text-2);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
}

.search-tab i { font-size: 16px; }
.search-tab:hover { color: var(--color-text); }

.search-tab.is-active {
  font-weight: 600;
  color: var(--color-accent-ink);
  border-bottom-color: var(--color-accent);
}

.filter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.filter-list > li + li { border-top: 1px solid var(--color-divider-soft); }

.filter-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-height: 56px;
  padding: 11px 16px;
  font: inherit;
  text-align: left;
  color: var(--color-text);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.filter-row:hover { background: var(--color-inset); }

.filter-row-head { display: flex; align-items: center; gap: 8px; width: 100%; }
.filter-row-name { font-size: 15px; font-weight: 600; }
.filter-star { font-size: 14px; color: var(--color-priority-high); }

.filter-row-owner {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--color-text-3);
}

/* The saved query is context, not the label — it truncates rather than wrapping
   a long JQL string across three lines and pushing the next filter off screen. */
.filter-row-jql,
.filter-active-jql {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-2);
}

.filter-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
}

.filter-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-accent-text);
  background: transparent;
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.filter-back:hover { background: var(--color-raised); }

.filter-active-name { font-size: 15px; font-weight: 600; }

.jql-result-count {
  margin: 12px 0 8px;
  font-size: 13px;
  color: var(--color-text-3);
}

/* A horizontal-scroll fallback for a narrow viewport; the wide dialog keeps
   every column visible in the normal case. */
.jql-results-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}

.jql-results-wrap .mapping-table { border: 0; border-radius: 0; }

/* Fixed layout: the colgroup's widths decide column sizes rather than each
   column growing to fit its own content, so the summary column truncates
   instead of pushing the table wider than the dialog. */
.jql-results-table { table-layout: fixed; width: 100%; min-width: 680px; }

.jql-results-table td, .jql-results-table th { vertical-align: middle; }
.jql-results-table td:first-child { font-weight: 400; }

/* The header stays put while a long results page scrolls under it. */
.jql-results-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.jql-results-table tbody tr:hover { background: var(--color-inset); }

.jql-col-select { width: 44px; }
.jql-col-key { width: 104px; white-space: nowrap; font-family: var(--font-mono); font-size: 12.5px; color: var(--color-accent-ink); }
.jql-col-status { width: 140px; overflow: hidden; }
.jql-col-person { width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-2); }
.jql-col-action { width: 92px; text-align: right; }

th.jql-col-key { font-family: var(--font-body); font-size: 12px; color: var(--color-text-3); }

.jql-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.jql-col-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jql-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--color-control-border);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-text);
}

.jql-add i { font-size: 13px; }

.status-chip {
  display: inline-block;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.status-chip-done { color: var(--color-success); background: var(--color-success-soft); }
.status-chip-stopped { color: var(--color-error); background: var(--color-error-soft); }
.status-chip-progress { color: var(--color-accent-ink); background: var(--color-accent-soft); }
.status-chip-default { color: var(--color-text-2); background: var(--color-chip); }

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.sort-header:hover { color: var(--color-text); }
.sort-header i { font-size: 11px; }

/* The search results' selection bar is the rail's, set inside the dialog. */
.dialog .rail-bulk-bar {
  margin: 0 0 16px;
  border-color: transparent;
  background: var(--color-accent-soft);
}

.dialog .rail-bulk-count { color: var(--color-accent-ink); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 26px;
  bottom: 24px;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 400px;
  max-width: calc(100vw - 32px);
  padding: 14px 10px 16px 16px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-raised);
  box-shadow: var(--shadow-md);
  animation: rise 0.25s ease-out;
}

.toast > i {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 18px;
  color: var(--color-accent-ink);
  background: var(--color-accent-soft);
}

.toast-text {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
}

.toast-sub {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--color-text-2);
}

/* The countdown on a toast that dismisses itself. Decorative — the real timer runs
   server-side; this only shows how much of it is left. */
.toast-timer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  transform-origin: left center;
  background: var(--color-accent);
  animation: toast-countdown var(--toast-ms) linear forwards;
}

@keyframes toast-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* nocturne.css flattens every animation to 0.01ms under reduced motion, which would
   leave this bar empty while the toast is still on screen. The duration is carried in
   a custom property so it survives that, since the bar reports a real countdown rather
   than decorating one. It just stops being the thing that draws the eye. */
@media (prefers-reduced-motion: reduce) {
  .toast-timer {
    animation-duration: var(--toast-ms) !important;
    opacity: 0.5;
  }
}

.toast-dismiss {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-top: -4px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  color: var(--color-text-3);
}

.toast-dismiss:hover { color: var(--color-text); background: var(--color-chip); }

/* ── Publish toast stack ─────────────────────────────────────────────────── */
.publish-toast-stack {
  position: fixed;
  right: 26px;
  bottom: 110px;
  z-index: 5;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  width: 400px;
  max-width: calc(100vw - 32px);
}

.publish-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 10px 16px 16px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  background: var(--color-raised);
  box-shadow: var(--shadow-md);
  animation: rise 0.25s ease-out;
}

.publish-toast > i { flex: none; font-size: 22px; }
.publish-toast > .spinner-inline { width: 20px; height: 20px; border-width: 2.5px; margin: 0 1px; }
.publish-toast .icon-success { color: var(--color-success); }
.publish-toast .icon-error { color: var(--color-error); }

.publish-toast-failed {
  background: var(--color-error-panel);
  box-shadow: 0 0 0 1px var(--color-error-line), var(--shadow-float);
}

.publish-toast-failed .toast-sub { color: var(--color-error-ink); }

.publish-toast-link {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  padding: 0 4px;
}

/* How far a send has got, along the bottom edge. Shares its position with .toast-timer
   but never its toast: the timer only appears once a send is over, and this only while
   one is running. */
.publish-toast-progress {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 7px;
  height: 4px;
  border-radius: 999px;
  background: var(--color-chip);
}

.publish-toast-progress-fill {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: 999px;
  background: var(--color-accent-text);
  transition: width 0.35s ease-out;
}

.publish-toast-sent .toast-timer { background: var(--color-success); }

/* The width still moves — it is the message. Only the easing goes. */
@media (prefers-reduced-motion: reduce) {
  .publish-toast-progress-fill { transition: none; }
}

/* ── Dialog ──────────────────────────────────────────────────────────────── */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--color-backdrop);
  backdrop-filter: blur(3px);
}

.dialog {
  display: flex;
  flex-direction: column;
  width: 720px;
  max-width: 100%;
  max-height: min(88vh, 900px);
  padding: 26px 30px 22px;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  animation: rise 0.2s ease-out;
}

/* Wide enough for the JQL results table's extra columns; other dialogs keep the
   default width. */
.dialog-wide { width: 1040px; }

/* Only the middle scrolls, so the confirm button never moves out of reach. */
.dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -30px 0;
  padding: 4px 30px 18px;
}

.dialog h3 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.01em; }

.dialog-lede {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text-2);
}

.dialog-warning {
  display: flex;
  gap: 12px;
  padding: 13px 15px;
  margin: 0 0 14px;
  border-radius: var(--radius-md);
  background: var(--color-warn-soft);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-warn-ink);
}

.dialog-warning i {
  flex: none;
  margin-top: 2px;
  font-size: 18px;
  color: var(--color-warn);
}

/* An "info" note is not a warning: same shape, no alarm. */
.dialog-warning:has(> .ph-info) {
  background: var(--color-raised);
  color: var(--color-text-body);
}

.dialog-warning:has(> .ph-info) i { color: var(--color-text-3); }

.dialog-summary {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  margin-bottom: 16px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 14px;
}

.dialog-summary-row { display: contents; }

.dialog-summary-row > span {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.dialog-summary-row:last-child > span { border-bottom: 0; }

.dialog-summary-row .key {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-3);
  background: var(--color-inset);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 -30px;
  padding: 16px 30px 0;
  border-top: 1px solid var(--color-divider-soft);
}

.dialog-actions .btn { min-height: var(--target); padding: 0 20px; }

.bulk-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.bulk-list-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  font-size: 14px;
}

.bulk-list-row + .bulk-list-row { border-top: 1px solid var(--color-divider-soft); }

.bulk-list-key {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-accent-ink);
}

.bulk-list-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-body);
}

.bulk-list-row .tag { border-radius: 999px; }

/* ── Blazor's own error UI, restyled to match ─────────────────────────────── */
#blazor-error-ui {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 14px 20px;
  background: var(--color-error-panel);
  color: var(--color-error-ink);
  box-shadow: 0 -1px 0 var(--color-error-line);
  font-size: 14px;
}

#blazor-error-ui .reload { margin-left: 8px; font-weight: 600; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

.banner-inline-link { margin-left: auto; }

/* ============================================================================
   Phones.

   The desktop shape is a persistent rail beside a pane, and it is the right
   shape because both fit. A phone fits one, so the same two parts become two
   screens: the queue is home, and opening a row pushes the pane over it with a
   way back. Nothing is removed and nothing is rearranged - the rail is still
   brand, search, list, settings, in that order - so the phone is the desktop
   with one column instead of two.

   Three things a phone needs that a desktop does not, and which the first
   attempt at this got wrong:
   - only one region may scroll, or the page fights the finger;
   - the way out of a screen must stay on screen while it scrolls;
   - settings must be reachable without scrolling past the whole queue.

   Everything here is inside a media query. A wide window renders exactly what
   it rendered before.
   ========================================================================= */

/* No rail to click on a phone, so the pane carries its own way back. A desktop
   has the rail in front of it and needs none. */
.back-to-queue { display: none; }

@media (max-width: 900px) {
  /* dvh, not vh: mobile browser chrome slides away and vh does not notice, so a
     vh-tall shell is taller than the screen for as long as the bar is showing.
     min-height: 720px went with it - that alone was taller than the phone. */
  .shell {
    flex-direction: column;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  /* ── Home: the queue ──────────────────────────────────────────────────── */

  .rail {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    border-right: none;
  }

  .shell--detail .rail { display: none; }

  /* Brand and search stay; the list scrolls under them. Losing the search box
     behind a scroll is losing the only way to find anything in a long queue. */
  .rail-brand {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 12px 16px 10px;
    background: var(--color-rail);
    border-bottom: 1px solid var(--color-rail-line);
  }

  /* The paragraph explains the rail to someone seeing it beside a pane. On a
     phone the rail is the whole screen and explains itself. The search box is
     inside this block, so only the paragraph goes. */
  .rail-explainer { display: none; }

  .rail-intro {
    position: sticky;
    top: 53px;
    z-index: 2;
    padding: 12px 16px;
    background: var(--color-rail);
  }

  .rail-list { min-height: 0; }
  .rail-list-header { position: static; }
  .rail-rows { padding: 0 0 12px; }

  /* A finger needs room. A native checkbox draws whatever box it is given, so
     sizing it to the full 44px target painted a grey block the width of a thumb;
     it grows a little instead and keeps clear space around it. */
  .rail-row { min-height: var(--target); }

  .rail-check {
    width: 22px;
    height: 22px;
    margin: 12px 6px 0 8px;
  }

  .rail-list-header .rail-check { width: 22px; height: 22px; margin: 0; }

  /* Settings sits at the foot of a rail that is now a whole screen, so reaching
     it would mean scrolling past every row. Pinned instead, above the home
     indicator. */
  .rail-footer {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--color-rail);
    border-top: 1px solid var(--color-rail-line);
  }

  .rail-footer-link { min-height: var(--target); }

  /* ── The pane, pushed over it ─────────────────────────────────────────── */

  .main { display: none; }

  .shell--detail .main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

  /* Stays put while the content scrolls: a way back that scrolls away is a way
     back you have to scroll to find. */
  .back-to-queue {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: var(--target);
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid var(--color-divider);
    background: var(--color-rail);
    color: var(--color-text);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }

  /* The preview header is sticky against the pane on desktop. Under the back
     bar it would cover it, so it scrolls here and the back bar is what stays. */
  .preview-header {
    position: static;
    padding: 16px;
  }

  .preview-body { padding: 16px 16px 64px; gap: 16px; }
  .preview-title { font-size: 20px; }

  /* The actions wrap under the title rather than squeezing it to nothing. */
  .preview-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .preview-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .preview-actions .btn { flex: 1 1 auto; }

  .differs-legend { margin-left: 0; }

  /* Four columns of field mapping do not fit in 375px. Each field becomes a
     block with its label above its value - the same information in the same
     order, stacked. */
  .fields,
  .fields-row {
    display: block;
  }

  .fields-head { display: none; }

  .fields-row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-divider-soft);
  }

  .fields-row > * { display: block; margin-top: 6px; }
  .fields-row > :first-child { margin-top: 0; }

  /* An input does not wrap, so it has to be told how much room it has or it
     runs past the card it sits in. */
  .fields-value,
  .fields-value-static,
  .mapping-select,
  .fields-notion,
  .settings .input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .panel-head { padding: 12px 16px; }
  .panel-inner { padding-left: 16px; padding-right: 16px; }
  .panel-foot, .comment-more { padding-left: 16px; padding-right: 16px; }
  .description { padding: 16px; font-size: 15px; }
  .panel-hint, .panel-target { margin-left: 0; width: 100%; }

  .two-up,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings { padding: 20px 16px 48px; }
  .settings-nav { max-width: none; flex-direction: row; overflow-x: auto; }
  .settings-tab { flex: none; }
  .settings-card { padding: 18px 16px 4px; }
  .settings-actions { margin: 18px -16px 0; padding: 14px 16px; }
  .settings > .settings-actions { margin: 0 0 18px; }

  .settings-rows > .field {
    grid-template-columns: 1fr;
    grid-template-areas: "label" "hint" "select";
  }

  /* 40px of padding and a 400px paragraph do not both fit in 375px. The panel
     also stops centring itself in a full-height box: with the back bar above
     it, there is no full height left to centre in. */
  .state-panel {
    height: auto;
    min-height: 60vh;
    padding: 32px 16px;
  }

  .state-panel p { max-width: 100%; }

  .state-panel .actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  /* A dialog is already phone-width; what it cannot be is 88vh tall with a
     keyboard open. It takes the screen instead. */
  .dialog,
  .dialog-wide {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 16px;
  }

  .dialog-body { margin: 0 -16px; padding: 4px 16px 16px; }
  .dialog-actions { margin: 0 -16px; padding: 14px 16px env(safe-area-inset-bottom, 0); }
  .dialog-backdrop { align-items: stretch; padding: 0; }

  .dialog-summary { grid-template-columns: 96px minmax(0, 1fr); }

  /* Wide tables scroll sideways rather than making the page do it. */
  .jql-results-wrap,
  .mapping-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .toast,
  .publish-toast-stack {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .toast { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* Between a phone and a laptop both still fit, so the rail gives up width
   rather than the pane: the pane is where the reading happens. */
@media (min-width: 901px) and (max-width: 1200px) {
  .rail {
    width: 272px;
    flex: 0 0 272px;
  }

  /* Three items no longer fit a footer this narrow; the icon and its title say
     enough. */
  .rail-sign-out-label { display: none; }
  .rail-status { display: none; }

  .preview-header { padding: 18px 24px 16px; }
  .preview-body { padding: 22px 24px 60px; }
  .settings { padding: 28px 24px 60px; }

  .fields { grid-template-columns: 120px minmax(0, 1.2fr) minmax(0, 1fr) 190px; }
}

/* ── Sign-in and access pages ─────────────────────────────────────────────
   Server-rendered, no shell. A short account of the app beside one card; on a
   phone the account shrinks to the brand and one line, and the card is the
   screen, because that is wherever somebody happened to open the link. */
.access {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-wrap: wrap;
  background: var(--color-bg);
}

.access-intro {
  flex: 1 1 420px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: 48px 56px;
  background: var(--color-rail);
  border-right: 1px solid var(--color-rail-line);
}

.access-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-priority-medium);
}

.access-wordmark {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.access-pitch {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 520px;
}

.access-headline {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.access-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.access-steps li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text-2);
}

.access-steps strong { font-weight: 600; color: var(--color-text); }

.access-step-number {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-top: -3px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent-ink);
  background: var(--color-raised);
}

.access-footnote {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-3);
}

.access-main {
  flex: 1 1 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(48px + env(safe-area-inset-top, 0px)) 24px calc(48px + env(safe-area-inset-bottom, 0px));
}

.access-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 36px 30px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  box-shadow: var(--shadow-float);
}

.access-title {
  font-size: 26px;
  margin-bottom: var(--space-2);
}

.access-card p { font-size: 15px; line-height: 1.55; }

.access-lead { color: var(--color-text-2); }

.access-muted {
  font-size: 14px;
  color: var(--color-text-3);
}

.access-muted strong { color: var(--color-text); font-weight: 600; }

.access-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0 16px;
}

/* A thumb's worth of target, the whole width of the card. */
.access-action {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
}

.access-action i { font-size: 19px; }

.access-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  color: var(--color-success-ink);
  background: var(--color-success-soft);
}

.access-notice i { font-size: 19px; color: var(--color-success); }

.access code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--color-raised);
}

/* On a phone the card is the screen: the account above it shrinks to the brand
   and the headline, and the buttons sit low enough to reach one-handed. */
@media (max-width: 900px) {
  .access { flex-direction: column; flex-wrap: nowrap; }

  .access-intro {
    flex: none;
    gap: 14px;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--color-rail-line);
  }

  .access-headline { font-size: 20px; }
  .access-steps, .access-footnote { display: none; }

  .access-main {
    flex: 1 1 auto;
    align-items: stretch;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 480px) {
  .access-card {
    display: flex;
    flex-direction: column;
    max-width: none;
    padding: 8px 4px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .access-actions { margin-top: auto; padding-top: 32px; }
  .access-action { min-height: 52px; }
}
