/* ============================================
   ReliefQuest Admin — Design System v2
   Aligned with app: BrandMaroon #6A1213
   ============================================ */

:root {
  /* Core palette */
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: rgba(26,26,26,.55);
  --line: rgba(0,0,0,.07);
  --maroon: #6A1213;
  --maroon-light: rgba(106,18,19,.06);
  --maroon-border: rgba(106,18,19,.18);
  --danger: #b91c1c;
  --ok: #166534;
  --pill: #f4f4f5;

  /* Status colors */
  --status-pending-bg: #fef3c7;
  --status-pending-fg: #92400e;
  --status-approved-bg: #d1fae5;
  --status-approved-fg: #065f46;
  --status-rejected-bg: #fee2e2;
  --status-rejected-fg: #991b1b;
  --status-duplicate-bg: #e5e7eb;
  --status-duplicate-fg: #374151;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 24px;
  --sp-2xl: 32px;

  /* Surfaces */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.12);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.rqWrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--sp-lg) var(--sp-xl);
}

/* Card */
.rqCard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Flex row */
.rqRow {
  display: flex;
  gap: var(--sp-md);
  align-items: center;
  flex-wrap: wrap;
}
.rqSp { flex: 1; }

/* Typography */
.rqH1 {
  margin: 0;
  font-size: 17px;
  color: var(--maroon);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.rqMeta {
  font-size: 12px;
  color: var(--muted);
}
.rqHint {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
}

/* ============================================
   Header
   ============================================ */
.rqHeader {
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: none;
}
.rqHeader .hdr-row1 {
  display: flex;
  gap: var(--sp-md);
  align-items: center;
  flex-wrap: wrap;
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--line);
}
.rqHeader .hdr-row1 .title {
  font-size: 16px;
  font-weight: 900;
  color: var(--maroon);
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.rqHeader .hdr-row1 .sp { flex: 1; }
.rqHeader .hdr-row1 .status {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(22,101,52,.08);
  color: var(--ok);
  font-weight: 600;
}
.rqHeader .hdr-row1 .status.err {
  background: rgba(185,28,28,.08);
  color: var(--danger);
}
.rqHeader .hdr-row1 .last {
  font-size: 10px;
  color: var(--muted);
}

/* Tabs */
.rqTabs {
  display: flex;
  gap: 0;
  padding: 0 var(--sp-lg);
  background: var(--card);
  border-radius: 0 0 var(--radius) var(--radius);
}
.rqTab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: var(--sp-md) var(--sp-lg);
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.rqTab:hover {
  color: var(--ink);
  background: rgba(0,0,0,.02);
}
.rqTab.active {
  color: var(--maroon);
  border-bottom-color: var(--maroon);
}


/* ============================================
   Shell v2 - 3-layer admin shell
   ============================================ */
.rqShell {
  position: sticky;
  top: 0;
  z-index: 100;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  margin-bottom: var(--sp-lg);
}
.shell-brand {
  display: flex;
  gap: var(--sp-md);
  align-items: center;
  padding: var(--sp-sm) var(--sp-lg);
  background: #1a1a1a;
  color: #fff;
}
.shell-logo {
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  background: var(--maroon);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}
.shell-title {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,.85);
}
.shell-spacer { flex: 1; }
.shell-search {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 12px;
  min-width: 160px;
}
.shell-search::placeholder { color: rgba(255,255,255,.35); }
.shell-search:focus { outline: none; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.12); }
.shell-status {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(22,101,52,.15);
  color: #4ade80;
  font-weight: 600;
}
.shell-status.err { background: rgba(239,68,68,.15); color: #f87171; }
.shell-nav {
  display: flex;
  gap: 0;
  background: #242424;
  padding: 0 var(--sp-lg);
}
.shell-tab {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  text-decoration: none;
  color: rgba(255,255,255,.5);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.shell-tab:hover { color: rgba(255,255,255,.8); }
.shell-tab.active { color: #fff; border-bottom-color: var(--maroon); }
.shell-context {
  display: flex;
  gap: var(--sp-md);
  align-items: center;
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--card);
  border-top: 1px solid var(--line);
}
.ctx-sel {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--pill);
  min-width: 120px;
}
.ctx-sel:focus { outline: none; border-color: var(--maroon-border); }
.ctx-quest { font-weight: 700; color: var(--maroon); }
.ctx-sep { color: var(--muted); font-size: 12px; }
.ctx-meta { font-size: 10px; color: var(--muted); margin-left: auto; }

/* ============================================
   Forms & Controls
   ============================================ */
.rqSel, .rqInp {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 13px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.rqSel:focus, .rqInp:focus {
  outline: none;
  border-color: var(--maroon-border);
  box-shadow: 0 0 0 3px rgba(106,18,19,.08);
}
.rqSel { min-width: 140px; }
.rqInp { min-width: 180px; }

/* Buttons */
.rqBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xs);
  border: 1px solid transparent;
  background: var(--maroon);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.rqBtn:hover {
  opacity: .92;
  box-shadow: 0 2px 6px rgba(106,18,19,.2);
}
.rqBtn:active { transform: scale(.98); }
.rqBtn.secondary {
  background: #fff;
  color: var(--maroon);
  border: 1px solid var(--maroon-border);
}
.rqBtn.secondary:hover {
  background: var(--maroon-light);
  box-shadow: none;
}
.rqBtn.danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid rgba(185,28,28,.25);
}
.rqBtn.danger:hover {
  background: rgba(185,28,28,.04);
  box-shadow: none;
}
.rqBtn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}
.rqBtn.small {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: var(--radius-xs);
}

/* ============================================
   Debug bar
   ============================================ */
.rqDebug {
  display: none;
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #111;
  color: #9ef0a8;
  padding: var(--sp-sm) var(--sp-md);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  border-bottom: 2px solid #2f2;
  max-height: 150px;
  overflow: auto;
}

/* ============================================
   Toggle / Checkbox
   ============================================ */
.rqToggle {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.rqToggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--maroon);
}

/* ============================================
   Tooltips
   ============================================ */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  white-space: nowrap;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  pointer-events: none;
}

/* ============================================
   Section spacing utility
   ============================================ */
.rqSection {
  margin-top: var(--sp-xl);
}
.rqSection--sm {
  margin-top: var(--sp-lg);
}
.rqCardPad {
  padding: var(--sp-lg) var(--sp-xl);
}

/* ============================================
   Keyboard shortcuts - Review focus
   ============================================ */
.feed-card.kb-focus {
  outline: 2px solid var(--maroon);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(106,18,19,.12), var(--shadow);
}
.feed-card.removing {
  opacity: 0;
  transform: translateX(40px) scale(.97);
  transition: opacity .3s ease, transform .3s ease;
}
.kb-hint {
  display: flex;
  gap: var(--sp-lg);
  align-items: center;
  padding: var(--sp-sm) var(--sp-lg);
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.5);
  border-radius: 0 0 var(--radius) var(--radius);
}
.kb-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}

/* ============================================
   Approval / Rejection card animations
   ============================================ */
.feed-card.removing.approved-anim {
  background: var(--status-approved-bg);
  border-color: var(--status-approved-fg);
  transform: translateX(40px) scale(.97);
  opacity: 0;
  transition: all .35s ease;
}
.feed-card.removing.rejected-anim {
  background: var(--status-rejected-bg);
  border-color: var(--status-rejected-fg);
  transform: translateX(-30px) scale(.97);
  opacity: 0;
  transition: all .3s ease;
}
