/* Decide Direct Defer, agoodun.com
   Brand tokens, type stack and component shapes follow BRAND.md and the
   rest of the agoodun.com suite. */

:root {
  --color-primary: #ce0f69;
  --color-secondary-teal: #009ca6;
  --color-secondary-purple: #68478d;
  --color-tertiary-gold: #ffb81c;
  --color-tertiary-black: #000000;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Plenty of classes below set `display`, which would otherwise beat the
   browser's own [hidden] rule and leave "hidden" things on screen. */
[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: var(--color-tertiary-black);
}

a {
  color: inherit;
}

.muted {
  color: #6b7280;
}

.small {
  font-size: 0.8rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Shell and nav
   --------------------------------------------------------------------- */

.app-shell {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.nav-context {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-app-name {
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-divider {
  width: 1px;
  height: 18px;
  background: #e5e7eb;
}

.nav-context-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-secondary-purple);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: #f4f5f7;
  color: var(--color-tertiary-black);
}

.nav-link.active {
  color: var(--color-primary);
  background: rgba(206, 15, 105, 0.08);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-email {
  font-size: 0.8rem;
  color: #6b7280;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-logout:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Cards and headings
   --------------------------------------------------------------------- */

.card {
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.card.accent {
  border-top: 6px solid transparent;
  border-image: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-secondary-teal),
    var(--color-secondary-purple),
    var(--color-tertiary-gold)
  );
  border-image-slice: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  margin-bottom: 24px;
}

.card-header .page-title {
  margin-bottom: 16px;
  flex: 1;
  min-width: 240px;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.5;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.count {
  font-size: 0.8rem;
  font-weight: 700;
  color: #6b7280;
  background: #f4f5f7;
  border-radius: 999px;
  padding: 2px 10px;
}

.empty-line {
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.55;
  padding: 8px 0;
}

.empty-line a {
  color: var(--color-primary);
  font-weight: 600;
}

.status {
  font-size: 0.88rem;
  color: #6b7280;
  padding: 8px 0;
}

.setup-notice {
  border-left: 6px solid var(--color-tertiary-gold);
  padding: 20px 24px;
}

.setup-notice h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.setup-notice p {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #374151;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */

.input-group {
  margin-bottom: 24px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
}

.field-hint {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 10px;
}

.field-hint.inline {
  margin: 0;
}

.label-optional {
  font-weight: 400;
  color: #6b7280;
}

.text-input,
.text-area,
.select-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-tertiary-black);
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 11px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-area {
  resize: vertical;
  line-height: 1.55;
}

.text-area.small {
  font-size: 0.9rem;
  padding: 9px 12px;
}

.text-input.compact,
.select-input.compact {
  font-size: 0.85rem;
  padding: 7px 10px;
  width: auto;
}

.text-input:focus,
.text-area:focus,
.select-input:focus,
.title-input:focus,
.solution-input:focus,
.inline-input:focus,
.inline-date:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

/* The autosave confirmation. */
.saved {
  border-color: var(--color-secondary-teal) !important;
  box-shadow: 0 0 0 3px rgba(0, 156, 166, 0.14) !important;
}

.date-input {
  width: auto;
  flex: 0 0 auto;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.add-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.add-row .text-input:not(.date-input) {
  flex: 1 1 220px;
  width: auto;
}

.form-error {
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #b91c1c;
}

.check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-secondary-teal);
  cursor: pointer;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 10px;
  padding: 11px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

.btn-primary.small {
  font-size: 0.85rem;
  padding: 8px 14px;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #b00d5a;
}

.btn-secondary {
  background: #ffffff;
  color: #374151;
  border-color: #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-text {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: none;
}

.btn-text:hover {
  color: #b00d5a;
}

.btn-text.subtle {
  color: #6b7280;
  font-weight: 500;
  font-size: 0.8rem;
}

.btn-text.subtle:hover {
  color: var(--color-primary);
}

.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn-chip:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-chip.ai {
  color: var(--color-secondary-purple);
  border-color: rgba(104, 71, 141, 0.35);
}

.btn-chip.ai::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary-purple));
}

.btn-chip.ai:hover:not(:disabled) {
  background: rgba(104, 71, 141, 0.06);
  border-color: var(--color-secondary-purple);
  color: var(--color-secondary-purple);
}

.btn-chip.danger:hover:not(:disabled) {
  color: #b91c1c;
  border-color: #fca5a5;
}

.btn-icon {
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1;
  color: #9ca3af;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.btn-icon:hover:not(:disabled) {
  color: #b91c1c;
  border-color: #fca5a5;
}

.chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------
   Pills
   --------------------------------------------------------------------- */

.pill {
  display: inline-block;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 3px 9px;
  background: #f4f5f7;
  color: #6b7280;
  white-space: nowrap;
}

.pill.decide {
  background: rgba(206, 15, 105, 0.1);
  color: var(--color-primary);
}

.pill.direct {
  background: rgba(0, 156, 166, 0.12);
  color: #007a82;
}

.pill.confirmed {
  background: var(--color-secondary-teal);
  color: #ffffff;
}

.pill.pending {
  background: rgba(255, 184, 28, 0.2);
  color: #8a5a00;
}

.pill.defer {
  background: #eef0f3;
  color: #6b7280;
}

.pill.none {
  background: #ffffff;
  color: #6b7280;
  box-shadow: inset 0 0 0 1px #d1d5db;
}

.pill.kind-problem { background: rgba(206, 15, 105, 0.1); color: var(--color-primary); }
.pill.kind-solution { background: rgba(104, 71, 141, 0.12); color: var(--color-secondary-purple); }
.pill.kind-task { background: rgba(0, 156, 166, 0.12); color: #007a82; }
.pill.kind-question { background: rgba(255, 184, 28, 0.2); color: #8a5a00; }

/* ---------------------------------------------------------------------
   Problem list
   --------------------------------------------------------------------- */

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.88rem;
  color: #374151;
  margin-bottom: 22px;
}

.overdue-text {
  color: #b91c1c;
}

.new-problem {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid #f0f1f3;
}

.new-problem label {
  margin-bottom: 0;
}

.problem-list,
.rank-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.problem-row,
.rank-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid #f0f1f3;
  background: #ffffff;
}

.rank-row {
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  padding: 10px 0;
}

.problem-row:last-child,
.rank-row:last-child {
  border-bottom: none;
}

.drag-handle {
  width: 28px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
  color: #9ca3af;
}

.drag-handle:hover,
.drag-handle:focus-visible {
  background: #f4f5f7;
  color: #374151;
  outline: none;
}

.drag-handle:focus-visible {
  box-shadow: 0 0 0 2px var(--color-primary);
}

.grip {
  width: 10px;
  height: 16px;
  background-image: radial-gradient(currentColor 1.5px, transparent 1.6px);
  background-size: 5px 5.33px;
}

.sorting,
.sorting * {
  cursor: grabbing !important;
  user-select: none;
}

/* The lifted row. Its framing is all box-shadow, which takes no space, so
   the row keeps exactly the size of the slot it came from. */
.dragging {
  background: #ffffff;
  border-radius: 10px;
  border-bottom-color: transparent;
  box-shadow: 0 0 0 10px #ffffff, 0 0 0 12px var(--color-primary), 0 18px 40px rgba(0, 0, 0, 0.18);
}

.sort-placeholder {
  list-style: none;
  border: 2px dashed rgba(206, 15, 105, 0.35);
  border-radius: 12px;
  background: rgba(206, 15, 105, 0.04);
}

.rank-num {
  min-width: 28px;
  height: 28px;
  margin-top: 2px;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
  background: rgba(206, 15, 105, 0.08);
  border-radius: 8px;
}

.rank-row .rank-num {
  margin-top: 0;
}

.problem-row-main,
.rank-row-main {
  min-width: 0;
}

.rank-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.problem-row-title {
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.35;
}

.problem-row-title:hover {
  color: var(--color-primary);
}

.rank-row-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
}

.rank-row-meta {
  font-size: 0.8rem;
  color: #6b7280;
}

.problem-row-desc {
  font-size: 0.86rem;
  color: #6b7280;
  line-height: 1.5;
  margin-top: 4px;
}

.glance {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.glance li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.86rem;
  line-height: 1.4;
}

.glance-text {
  text-decoration: none;
  color: #374151;
}

.glance-text:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.glance-detail {
  font-size: 0.78rem;
  color: #6b7280;
}

.glance-empty {
  font-size: 0.82rem;
  color: #9ca3af;
  margin-top: 8px;
}

.glance-deferred {
  display: inline-block;
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 8px;
}

.row-map {
  margin-top: 2px;
}

/* ---------------------------------------------------------------------
   Problem editor
   --------------------------------------------------------------------- */

.problem-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.problem-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rank-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-primary);
  background: rgba(206, 15, 105, 0.08);
  border-radius: 8px;
  padding: 4px 10px;
}

.title-input {
  width: 100%;
  font-family: inherit;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--color-tertiary-black);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 6px 10px;
  margin-left: -10px;
  width: calc(100% + 20px);
  background: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.title-input:hover {
  border-color: #e5e7eb;
}

.origin {
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.5;
  border-left: 3px solid var(--color-tertiary-gold);
  padding: 2px 0 2px 10px;
}

.origin a {
  color: var(--color-primary);
  font-weight: 600;
}

.connections {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
}

.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.82rem;
  background: rgba(104, 71, 141, 0.08);
  border-radius: 999px;
  padding: 3px 4px 3px 11px;
}

.link-chip a {
  text-decoration: none;
  color: var(--color-secondary-purple);
  font-weight: 600;
}

.link-chip a:hover {
  text-decoration: underline;
}

.link-chip button {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  border-radius: 50%;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

.link-chip button:hover {
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
}

.solution-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
}

.solution {
  border: 1px solid #e5e7eb;
  border-left: 4px solid #d1d5db;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.3s ease;
}

.solution.tone-decide { border-left-color: var(--color-primary); }
.solution.tone-direct { border-left-color: var(--color-secondary-teal); }

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

.solution-input,
.inline-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-tertiary-black);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  background: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.inline-input {
  font-size: 0.9rem;
  font-weight: 500;
}

.solution-input:hover,
.inline-input:hover,
.inline-date:hover {
  border-color: #e5e7eb;
}

.eval-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.eval-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
}

.judgement-row {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
}

.judgement-note {
  flex: 1 1 160px;
}

.yesno {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.yesno-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  margin-right: 4px;
}

.yesno-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 5px 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.yesno-btn:hover {
  border-color: #9ca3af;
  color: #374151;
}

.yesno-btn.on.yes {
  background: var(--color-secondary-teal);
  border-color: var(--color-secondary-teal);
  color: #ffffff;
}

.yesno-btn.on.no {
  background: #374151;
  border-color: #374151;
  color: #ffffff;
}

/* Triage */

.triage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed #e5e7eb;
}

.triage-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.triage-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-family: inherit;
  text-align: left;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-top: 3px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.triage-btn strong {
  font-size: 0.92rem;
}

.triage-btn span {
  font-size: 0.76rem;
  color: #6b7280;
  line-height: 1.35;
}

.triage-btn.decide { border-top-color: var(--color-primary); }
.triage-btn.direct { border-top-color: var(--color-secondary-teal); }
.triage-btn.defer { border-top-color: #9ca3af; }

.triage-btn.decide:hover { background: rgba(206, 15, 105, 0.05); border-color: var(--color-primary); }
.triage-btn.direct:hover { background: rgba(0, 156, 166, 0.06); border-color: var(--color-secondary-teal); }
.triage-btn.defer:hover,
.triage-btn.defer.selected { background: #f4f5f7; border-color: #9ca3af; }

.inline-form {
  margin-top: 6px;
}

.triage-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 10px;
  background: #f9fafb;
}

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

.triage-head .btn-text {
  margin-left: auto;
}

.panel-status {
  font-size: 0.8rem;
  color: #6b7280;
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-row,
.question {
  background: #ffffff;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  padding: 8px 10px;
  transition: box-shadow 0.3s ease;
}

.task-row.done .inline-input {
  color: #6b7280;
  text-decoration: line-through;
  text-decoration-color: #9ca3af;
}

.item-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.item-line .inline-input {
  flex: 1 1 200px;
}

.inline-date {
  font-family: inherit;
  font-size: 0.82rem;
  color: #374151;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 6px;
  background: transparent;
}

.inline-date.overdue,
.date-input.overdue {
  color: #b91c1c;
  background: #fef2f2;
}

.inline-date.today,
.date-input.today {
  color: #8a5a00;
  background: rgba(255, 184, 28, 0.18);
}

.flagged {
  font-size: 0.8rem;
  color: #6b7280;
  margin: 6px 0 2px;
}

.flagged a {
  color: var(--color-primary);
  font-weight: 600;
}

[data-flag-area] > .btn-text {
  margin-top: 4px;
}

.flag-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 184, 28, 0.1);
  border: 1px solid rgba(255, 184, 28, 0.45);
}

.flag-form label {
  margin: 0;
}

/* Direct */

.direct-form,
.direct-brief {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.direct-form label,
.direct-brief label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-size: 0.78rem;
  color: #6b7280;
}

.direct-brief .check-label {
  flex-direction: row;
  font-size: 0.85rem;
  color: #374151;
}

.direct-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.agree-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 6px 12px 6px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.agree-toggle:hover {
  border-color: var(--color-secondary-teal);
}

.agree-box {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #9ca3af;
  position: relative;
}

.agree-toggle.on {
  background: rgba(0, 156, 166, 0.1);
  border-color: var(--color-secondary-teal);
  color: #006d74;
}

.agree-toggle.on .agree-box {
  background: var(--color-secondary-teal);
  border-color: var(--color-secondary-teal);
}

.agree-toggle.on .agree-box::after {
  content: "";
  position: absolute;
  left: 3.5px;
  top: 0.5px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px dashed #e5e7eb;
}

.questions .section-head {
  margin-bottom: 0;
}

.question {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question.agreed {
  border-color: rgba(0, 156, 166, 0.35);
}

.confirm-checklist {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.8rem;
  color: #6b7280;
}

.confirm-checklist li::before {
  content: "\25CB";
  margin-right: 6px;
  color: #9ca3af;
}

.confirm-checklist li.met {
  color: #006d74;
}

.confirm-checklist li.met::before {
  content: "\2713";
  color: var(--color-secondary-teal);
  font-weight: 700;
}

/* Deferred */

.deferred-block {
  margin-top: 22px;
  border-top: 1px solid #f0f1f3;
  padding-top: 14px;
}

.deferred-block summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
}

.deferred-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid #f0f1f3;
}

.deferred-item:last-child {
  border-bottom: none;
}

.deferred-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 260px;
  min-width: 0;
  font-size: 0.9rem;
}

.deferred-text p {
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.5;
}

.deferred-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.deferred-problem {
  display: block;
  font-weight: 700;
  text-decoration: none;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(206, 15, 105, 0.15);
}

.deferred-problem:hover {
  color: var(--color-primary);
}

.highlight {
  box-shadow: 0 0 0 3px rgba(255, 184, 28, 0.75);
}

.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: #374151;
}

.pager-link:last-child {
  text-align: right;
}

.pager-link:hover {
  color: var(--color-primary);
}

.pager-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
}

/* ---------------------------------------------------------------------
   Working session
   --------------------------------------------------------------------- */

.session-bar {
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stage-actions {
  margin-top: 20px;
}

.step-bar {
  padding: 16px 20px;
}

.step-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.step-position {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  min-width: 0;
}

.step-position select {
  max-width: 100%;
}

.step-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f1f3;
}

.up-next {
  font-size: 0.8rem;
  color: #6b7280;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  justify-content: flex-end;
}

.up-next span {
  color: #374151;
}

/* ---------------------------------------------------------------------
   Mind map
   --------------------------------------------------------------------- */

.mind-map {
  width: 100%;
  height: 560px;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid #eef0f3;
  overflow: hidden;
}

.map-error {
  padding: 24px;
}

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  font-size: 0.8rem;
  color: #6b7280;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 14px;
  height: 10px;
  border-radius: 3px;
  border: 2px solid;
}

.swatch.problem { border-color: var(--color-primary); background: #fdf2f8; }
.swatch.solution { border-color: var(--color-secondary-purple); }
.swatch.task { border-color: var(--color-secondary-teal); }
.swatch.question { border-color: var(--color-tertiary-gold); }

.swatch.line {
  width: 20px;
  height: 0;
  border-radius: 0;
  border-width: 2px 0 0;
}

.swatch.line.connected { border-style: dashed; border-color: var(--color-secondary-purple); }
.swatch.line.flagged { border-color: var(--color-tertiary-gold); }

.node-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #374151;
}

.panel-title {
  font-size: 1.1rem;
  color: var(--color-tertiary-black);
  line-height: 1.35;
}

.due {
  font-size: 0.8rem;
  color: #6b7280;
  margin-left: 6px;
}

.due.overdue { color: #b91c1c; }
.due.today { color: #8a5a00; }

/* ---------------------------------------------------------------------
   Related search dialog
   --------------------------------------------------------------------- */

.related-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(80vh, 760px);
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  color: var(--color-tertiary-black);
}

.related-dialog::backdrop {
  background: rgba(17, 24, 39, 0.4);
}

.dialog-inner {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dialog-source {
  font-weight: 600;
  line-height: 1.4;
  margin-top: 4px;
}

.searching {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: #6b7280;
  padding: 18px 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  border-top-color: var(--color-secondary-purple);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.related-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.related-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f1f3;
}

.related-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.related-top a {
  font-weight: 600;
  text-decoration: none;
  line-height: 1.4;
}

.related-top a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.related-parent {
  font-size: 0.8rem;
  color: #6b7280;
}

.related-reason {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #374151;
}

.cost-line {
  font-size: 0.78rem;
  color: #9ca3af;
  margin-top: 12px;
}

.notice {
  font-size: 0.9rem;
  line-height: 1.55;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(255, 184, 28, 0.12);
  border: 1px solid rgba(255, 184, 28, 0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notice a {
  color: var(--color-primary);
  font-weight: 600;
}

.notice.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* ---------------------------------------------------------------------
   Toast
   --------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: calc(100vw - 32px);
  background: #111827;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.toast.error {
  background: #991b1b;
}

/* ---------------------------------------------------------------------
   Auth landing
   --------------------------------------------------------------------- */

.auth-landing {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 40px;
  align-items: center;
}

.hero-copy h1 {
  font-size: 2rem;
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: 1rem;
  line-height: 1.55;
  color: #374151;
  margin-bottom: 20px;
}

.hero-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 20px;
}

.hero-features li {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #374151;
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */

.powered-by a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #6b7280;
  font-size: 0.85rem;
  transition: color 0.15s ease;
}

.powered-by a:hover {
  color: var(--color-tertiary-black);
}

.powered-by-logo {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.powered-by strong {
  color: var(--color-primary);
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   Narrow screens
   --------------------------------------------------------------------- */

@media (max-width: 820px) {
  .auth-landing {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 12px;
  }

  .card {
    padding: 20px;
  }

  .eval-grid,
  .triage-buttons {
    grid-template-columns: 1fr;
  }

  /* The solution's own text gets the whole first line; its buttons drop
     beneath rather than squeezing it to a few letters. */
  .solution-top {
    flex-wrap: wrap;
  }

  .solution-input {
    flex-basis: 100%;
  }

  .solution-top .btn-icon {
    margin-left: auto;
  }

  .triage-btn {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
  }

  .problem-row {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .row-map {
    grid-column: 3;
    justify-self: start;
  }

  .step-nav {
    grid-template-columns: 1fr 1fr;
  }

  .step-position {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .direct-meta {
    grid-template-columns: 1fr;
  }

  .mind-map {
    height: 440px;
  }

  .pager {
    grid-template-columns: 1fr 1fr;
  }

  .pager > .btn-text {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  .nav-email {
    display: none;
  }
}
