/* ProfileRescue — app-specific styles (layered on top of styles.css design system) */

/* ---------- App shell ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  flex-shrink: 0;
}
.app-header .brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--primary-tint);
  border: 1px solid rgba(255, 107, 53, 0.3);
  position: relative;
}
.app-header .brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.app-header-tagline {
  display: none;
  color: var(--text-faint);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  padding-left: 14px;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}
@media (min-width: 900px) {
  .app-header-tagline { display: inline-block; }
}
.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.app-nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.app-nav-link:hover { background: var(--surface); color: var(--text); }
.app-nav-link.active { background: var(--primary-tint); color: var(--primary); }
.app-user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.app-user-name {
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-title {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.page-subtitle {
  color: var(--text-dim);
  margin-top: 6px;
  max-width: 620px;
  font-size: 0.96rem;
}
.section-title-left {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ---------- Loading ---------- */
.loading-block {
  padding: 48px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.92rem;
}
.loading-block-label { line-height: 1; }
.pr-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  flex-shrink: 0;
  animation: pr-spin 0.7s linear infinite;
}
@keyframes pr-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .pr-spinner { animation: none; }
}

/* ---------- Welcome banner ---------- */
.welcome-banner {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.12), rgba(45, 212, 167, 0.08));
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: var(--radius-md);
  padding: 24px 26px;
  margin-bottom: 24px;
}
.welcome-banner h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 8px; }
.welcome-banner p { color: var(--text-dim); margin-bottom: 16px; max-width: 640px; }

/* ---------- Case list ---------- */
.case-item { align-items: center; flex-wrap: wrap; }
.case-item-main { flex: 1; min-width: 220px; }
.case-item-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.case-item-top h3 { font-size: 1.05rem; font-weight: 700; max-width: 320px; }
.case-item-meta { color: var(--text-faint); font-size: 0.85rem; margin-top: 6px; }
.case-item-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Wizard ---------- */
.wizard-form { display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.wizard-form .field { margin-bottom: 20px; }

/* ---------- Cause report ---------- */
.cause-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 32px;
}
@media (min-width: 680px) {
  .cause-grid { grid-template-columns: repeat(2, 1fr); }
}
.cause-card { display: flex; flex-direction: column; gap: 10px; }
.cause-card p { color: var(--text-dim); font-size: 0.92rem; }

.checklist-section { margin-top: 8px; }
.checklist-row { align-items: flex-start; flex-wrap: wrap; }
.checklist-row-main { flex: 1; min-width: 240px; }
.checklist-row-main h4 { font-size: 0.98rem; font-weight: 700; margin-bottom: 4px; }
.checklist-desc { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 4px; }
.checklist-why { color: var(--text-faint); font-size: 0.82rem; }
.checklist-status-select { max-width: 170px; flex-shrink: 0; }
.bulk-actions-row { padding: 10px 14px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ---------- Appeal builder ---------- */
.appeal-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}
@media (min-width: 960px) {
  .appeal-layout { grid-template-columns: 1.1fr 0.9fr; }
}
.appeal-form-col .field { margin-bottom: 20px; }
.appeal-preview-col { position: sticky; top: 84px; }
.appeal-preview-col h3 { margin-bottom: 12px; font-size: 1rem; }
.example-phrasing { margin: 2px 0 4px; }
.example-phrasing summary { cursor: pointer; color: var(--accent); font-size: 0.8rem; font-weight: 600; }
.example-phrasing p { color: var(--text-faint); font-size: 0.82rem; margin-top: 6px; font-style: italic; }
.word-count-hint { display: block; font-size: 0.76rem; color: var(--text-faint); margin-top: 4px; }
.appeal-preview {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  max-height: 480px;
  overflow-y: auto;
  margin: 0;
}
.version-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.version-bar .badge:hover { filter: brightness(1.2); }

/* ---------- Review ---------- */
.review-summary {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  margin-bottom: 16px;
}
.review-summary.pass { background: var(--accent-tint); color: var(--accent); }
.review-summary.fail { background: var(--danger-tint); color: var(--danger); }
.review-rule { margin-bottom: 12px; }
.review-rule-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.rule-pass { border-color: rgba(45, 212, 167, 0.3); }
.rule-fail { border-color: rgba(255, 92, 108, 0.35); }
.review-rule p { color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Export ---------- */
.numbered-list {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-dim);
  font-size: 0.92rem;
}
.numbered-list li { list-style: decimal; padding-left: 6px; }
.plain-list { padding-left: 20px; color: var(--text-dim); font-size: 0.92rem; }
.plain-list li { list-style: disc; margin-bottom: 6px; }
.status-update-card { }
.outcome-row { background: var(--surface-raised); }

/* ---------- Escalation ---------- */
.escalation-card {
  border-color: rgba(255, 92, 108, 0.3);
  background: linear-gradient(135deg, rgba(255, 92, 108, 0.06), transparent);
}
.escalation-templates {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.escalation-template {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.escalation-template strong { display: block; margin-bottom: 6px; color: var(--danger); font-size: 0.9rem; }
.escalation-template p { color: var(--text-dim); font-size: 0.88rem; }

/* ---------- AI affordances ---------- */
.ai-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ai-btn { flex-shrink: 0; }

/* ---------- Dashboard quick status ---------- */
.quick-status-select {
  max-width: 160px;
  flex-shrink: 0;
}

/* ---------- Toast ---------- */
.pr-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  max-width: 90vw;
}
.pr-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.pr-toast-error { border-color: rgba(255, 92, 108, 0.4); color: var(--danger); }
.pr-toast-success { border-color: rgba(45, 212, 167, 0.4); color: var(--accent); }

/* ---------- Toolbar spacing on empty states within sections ---------- */
.empty-state { margin-top: 4px; }

/* ---------- Feedback modal ---------- */
.feedback-stars {
  display: flex;
  align-items: center;
  gap: 6px;
}
.feedback-star {
  background: none;
  border: none;
  padding: 2px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--border);
  cursor: pointer;
  transition: color 0.15s var(--ease), transform 0.12s var(--ease);
}
.feedback-star:hover { color: var(--primary-dim); transform: translateY(-1px); }
.feedback-star.active { color: var(--primary); }

/* ---------- Case context bar (stage pipeline + status/days) ---------- */
.case-context-bar { margin-bottom: 26px; }
.case-meta-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.case-meta-days { color: var(--text-faint); font-size: 0.85rem; }
.stage-bar {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 6px;
}
.stage-step {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-faint);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.stage-step:hover:not(:disabled) { background: var(--surface-raised); color: var(--text); }
.stage-step:disabled { cursor: not-allowed; }
.stage-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  font-size: 0.7rem;
}
.stage-step.complete { color: var(--text-dim); }
.stage-step.complete .stage-step-num { background: var(--accent-tint); color: var(--accent); border-color: rgba(45, 212, 167, 0.4); }
.stage-step.current { color: var(--text); }
.stage-step.current .stage-step-num { background: var(--primary-tint); color: var(--primary); border-color: rgba(255, 107, 53, 0.4); }
.stage-step.locked { color: var(--text-faint); opacity: 0.6; }
.stage-connector { width: 14px; height: 1px; background: var(--border); flex-shrink: 0; }

@media (max-width: 640px) {
  .app-header-inner { flex-wrap: wrap; }
  .app-nav { order: 3; width: 100%; overflow-x: auto; }
  .appeal-preview-col { position: static; top: auto; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .input { max-width: none !important; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions select.input { max-width: none !important; flex: 1; }
  .case-item-actions { width: 100%; }
  .quick-status-select { max-width: none; flex: 1; }
  .ai-field-label-row { flex-wrap: wrap; }
  .stage-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .case-meta-strip .btn { margin-left: 0 !important; }
  .bulk-actions-row { flex-direction: column; align-items: stretch; }
  .bulk-actions-row .btn { width: 100%; }
  .case-item-top h3.truncate { max-width: 60vw; }
}