/* "Where this belongs" — the reference panel + the targeting sheet
   (REFERENCE_LOOP RL-0/RL-2). Theme variables only; no hard-coded colours,
   so it follows light/dark like every other pane. */

.ide-refs {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border, #d9d9de);
  border-radius: 8px;
  background: var(--bg-input, transparent);
}

.ide-refs-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.ide-refs-title {
  font-weight: 600;
  color: var(--text, inherit);
}

.ide-refs-count {
  font-size: 0.85em;
  opacity: 0.7;
}

.ide-refs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ide-refs-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
  border-top: 1px solid var(--border, #eee);
}

.ide-refs-row:first-child {
  border-top: 0;
}

.ide-refs-open,
.ide-refs-remove {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  /* 44px targets on the iPad surfaces this also renders on (UX §7) */
  min-width: 32px;
  min-height: 32px;
  font-size: 1em;
}

.ide-refs-open:hover,
.ide-refs-remove:hover {
  opacity: 0.7;
}

.ide-refs-where {
  font-size: 0.85em;
  opacity: 0.75;
}

.ide-refs-what {
  font-weight: 500;
}

.ide-refs-snippet {
  flex: 1 1 100%;
  font-size: 0.85em;
  opacity: 0.7;
  padding-left: 32px;
}

.ide-refs-empty {
  margin: 4px 0;
  font-size: 0.9em;
  opacity: 0.75;
}

.ide-refs-find {
  margin-top: 8px;
  padding: 6px 12px;
  min-height: 36px;
  border: 1px solid var(--border, #d9d9de);
  border-radius: 6px;
  background: var(--bg-input, transparent);
  color: var(--text, inherit);
  cursor: pointer;
}

.ide-refs-find:hover:not(:disabled) {
  border-color: var(--accent, #6a7);
}

.ide-refs-find:disabled {
  opacity: 0.6;
  cursor: default;
}

/* The "Where does this belong?" sheet (RL-2). */

.ide-rsheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 16px;
}

.ide-rsheet {
  width: min(720px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--bg, #fff);
  color: var(--text, #111);
  border: 1px solid var(--border, #d9d9de);
  border-radius: 10px;
  overflow: hidden;
}

.ide-rsheet-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #eee);
}

.ide-rsheet-title {
  font-size: 1.05em;
  font-weight: 600;
}

.ide-rsheet-sub {
  opacity: 0.85;
  margin-top: 2px;
}

/* The honesty line. Never hidden, never truncated away (RL-INV-4). */
.ide-rsheet-scope {
  margin-top: 6px;
  font-size: 0.85em;
  opacity: 0.75;
}

.ide-rsheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 8px 4px;
}

.ide-rsheet-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
}

.ide-rsheet-row:hover {
  background: var(--bg-input, rgba(127, 127, 127, 0.08));
}

.ide-rsheet-l0 {
  font-weight: 600;
  margin-top: 6px;
}
.ide-rsheet-l1 {
  padding-left: 26px;
}
.ide-rsheet-l2 {
  padding-left: 52px;
  font-size: 0.92em;
}

.ide-rsheet-tick,
.ide-rsheet-peek {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font-size: 1em;
  /* 44px on the iPad surfaces this also renders on (UX §7) */
  min-width: 32px;
  min-height: 32px;
}

.ide-rsheet-label {
  flex: 0 1 auto;
}

.ide-rsheet-note {
  flex: 1 1 auto;
  font-size: 0.85em;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ide-rsheet-empty {
  padding: 24px 16px;
  opacity: 0.8;
}

.ide-rsheet-comment {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 16px;
  font-size: 0.85em;
  opacity: 0.9;
}

.ide-rsheet-comment input {
  padding: 6px 8px;
  min-height: 34px;
  border: 1px solid var(--border, #d9d9de);
  border-radius: 6px;
  background: var(--bg-input, transparent);
  color: var(--text, inherit);
}

.ide-rsheet-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border, #eee);
}

.ide-rsheet-spacer {
  flex: 1;
}

.ide-rsheet-btn {
  padding: 7px 14px;
  min-height: 36px;
  border: 1px solid var(--border, #d9d9de);
  border-radius: 6px;
  background: var(--bg-input, transparent);
  color: var(--text, inherit);
  cursor: pointer;
}

.ide-rsheet-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.ide-rsheet-primary {
  border-color: var(--accent, #6a7);
  font-weight: 600;
}

/* Phone: the sheet is the page. */
@media (max-width: 560px) {
  .ide-rsheet-overlay {
    padding: 0;
  }
  .ide-rsheet {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: 0;
  }
  .ide-rsheet-l1 {
    padding-left: 16px;
  }
  .ide-rsheet-l2 {
    padding-left: 32px;
  }
}

/* Follow-ups (RL-3) — the content register's tab. */

.ide-fu {
  padding: 8px 10px;
}

.ide-fu-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ide-fu-toggle {
  font-size: 0.85em;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ide-fu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ide-fu-card {
  border: 1px solid var(--border, #d9d9de);
  border-radius: 8px;
  padding: 8px 10px;
}

.ide-fu-closed {
  opacity: 0.55;
}

.ide-fu-title {
  font-weight: 500;
}

.ide-fu-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  font-size: 0.8em;
  opacity: 0.75;
}

.ide-fu-mine {
  border: 1px solid var(--border, #d9d9de);
  border-radius: 10px;
  padding: 0 6px;
}

.ide-fu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ide-fu-btn {
  padding: 4px 10px;
  min-height: 32px;
  border: 1px solid var(--border, #d9d9de);
  border-radius: 6px;
  background: var(--bg-input, transparent);
  color: var(--text, inherit);
  cursor: pointer;
  font-size: 0.9em;
}

.ide-fu-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.ide-fu-add {
  font-weight: 600;
}

.ide-fu-empty,
.ide-fu-hidden {
  font-size: 0.9em;
  opacity: 0.8;
  margin: 8px 0;
}

/* RL-INV-11 — who can read these. Quiet, but never absent. */
.ide-fu-reach {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border, #eee);
  font-size: 0.8em;
  opacity: 0.7;
}

/* Boards (RL-6). */

.ide-board-audience {
  margin: 4px 0 8px;
  font-size: 0.82em;
  opacity: 0.75;
}

.ide-board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ide-board-post {
  border: 1px solid var(--border, #d9d9de);
  border-radius: 8px;
  padding: 8px 10px;
}

.ide-board-pinned {
  border-color: var(--accent, #6a7);
}

.ide-board-pin {
  font-size: 0.75em;
  opacity: 0.8;
}

.ide-board-ref {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 500;
}

.ide-board-open {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  min-width: 28px;
  min-height: 28px;
}

.ide-board-body {
  margin-top: 4px;
}

.ide-board-meta {
  margin-top: 4px;
  font-size: 0.8em;
  opacity: 0.7;
  display: flex;
  gap: 8px;
}

.ide-board-hidden {
  font-style: italic;
}

.ide-board-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

/* The shared improvement card (RL-7). */

.ik-card {
  border: 1px solid var(--border, #d9d9de);
  border-radius: 8px;
  padding: 8px 10px;
  list-style: none;
}

.ik-title {
  font-weight: 500;
}

.ik-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  font-size: 0.8em;
  opacity: 0.75;
}

.ik-state {
  border: 1px solid var(--border, #d9d9de);
  border-radius: 10px;
  padding: 0 6px;
}

/* The line that was always in the store and never on a screen. */
.ik-prov {
  font-style: italic;
}

.ik-detail {
  margin-top: 4px;
  font-size: 0.92em;
}

.ik-evidence {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 0.85em;
  opacity: 0.8;
}

.ik-more {
  opacity: 0.7;
}

.ik-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ik-reach {
  margin-top: 6px;
  font-size: 0.78em;
  opacity: 0.7;
}

/* UX §5.10 — the improvement desk on a phone.
   The consoles size themselves with inline styles (max-width 640px, centred),
   which is right on a laptop and leaves decision buttons in a cramped row on
   a phone. These give the buttons a full-width column and keep 44px targets,
   without touching the consoles' own layout. */
@media (max-width: 560px) {
  .ik-actions,
  .ide-fu-actions,
  .ide-board-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ik-actions .ide-fu-btn,
  .ide-fu-actions .ide-fu-btn,
  .ide-board-actions .ide-fu-btn {
    width: 100%;
    min-height: 44px;
  }

  /* Board and Follow-up cards read as one column, with room to tap. */
  .ide-fu-card,
  .ide-board-post,
  .ik-card {
    padding: 12px;
  }

  .ide-fu-bar {
    flex-wrap: wrap;
  }

  .ide-fu-bar > * {
    min-height: 44px;
  }
}

/* "Related documents" on an idea for the app (RL-4). */

.ide-rd {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border, #3a3a5c);
  border-radius: 10px;
}

.ide-rd-head {
  font-weight: 600;
  font-size: 13.5px;
}

.ide-rd-hint {
  margin: 4px 0 8px;
  font-size: 12.5px;
  opacity: 0.75;
}

.ide-rd-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ide-rd-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.ide-rd-tick {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1em;
  min-width: 32px;
  min-height: 32px;
}

.ide-rd-name {
  font-weight: 500;
}

.ide-rd-sec,
.ide-rd-why {
  font-size: 12px;
  opacity: 0.72;
}

.ide-rd-why {
  flex: 1 1 100%;
  padding-left: 32px;
  font-style: italic;
}

.ide-rd-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.ide-rd-said {
  font-size: 12.5px;
  opacity: 0.8;
}

/* One home for improving the app (RL-7, UX §5.1). */

.ide-ih-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 20px 0;
}

.ide-ih-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  border: 1px solid var(--border, #3a3a5c);
  background: transparent;
  color: var(--text-muted, #9a9ac4);
}

.ide-ih-tab.on {
  border-color: var(--accent, #6c63ff);
  background: rgba(108, 99, 255, 0.16);
  color: var(--text, #e0e0f0);
  font-weight: 600;
}

/* The one-line "what is this tab" — the thing that stops somebody wondering
   which door to use. */
.ide-ih-hint {
  font-size: 11.5px;
  font-weight: 400;
  opacity: 0.8;
}

/* ⇩ Pull, above the tabs — the same pull as the build board's files strip
   (ide-improvement-console.js pullBar). Hidden until it has something to
   offer, so a box with no file lane shows no empty band. */
.ide-ih-pull {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 20px 0;
  font-size: 13px;
  color: var(--text-muted, #9a9ac4);
}

.ide-ih-pull button {
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  /* ⚠ a <button> inherits no colour and the UA sheet makes it black on a
     dark shell — PLUGIN_ARCHITECTURE §3b. Say it.
     ⚠ NOT white on the bare accent: measured 4.32:1, under AA's 4.5 for 13px
     text. A shade darker clears it at 5.59:1 and, being SOLID, does not read
     as a fourth tab beside the accent-washed selected one below. */
  color: #fff;
  font-weight: 600;
  background: #5a51e6;
  border: 1px solid #5a51e6;
  /* follows a themed accent where the browser can mix; the pair above is the
     fallback, so an older engine still gets a readable button. */
  background: color-mix(in srgb, var(--accent, #6c63ff) 82%, #000);
  border-color: color-mix(in srgb, var(--accent, #6c63ff) 82%, #000);
}

.ide-ih-pull button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.ide-ih-pull .ide-ih-pull-quiet {
  color: var(--text-muted, #9a9ac4);
  background: transparent;
  border-color: var(--border, #3a3a5c);
}

.ide-ih-pull-said {
  flex-basis: 100%;
  font-size: 12.5px;
}

.ide-ih-note {
  max-width: 640px;
  margin: 14px auto 0;
  padding: 0 20px;
  font-size: 13.5px;
  opacity: 0.85;
}

@media (max-width: 560px) {
  .ide-ih-pull {
    padding: 10px 12px 0;
  }
  .ide-ih-tabs {
    padding: 10px 12px 0;
  }
  .ide-ih-tab {
    flex: 1 1 100%;
  }
}
