/* Manual material requests — shared modal + card entry styles.
   Used by the Request Materials card on both the collateral and deliverable
   dashboards. Purple (#7c3aed) is the AI-summary accent (matches retention). */

/* ── Modal ─────────────────────────────────────────────────────────────── */
.mreq-overlay {
  position: fixed; inset: 0; z-index: 6000;
  background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.mreq-modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.mreq-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #eef0f4;
}
.mreq-modal-title { margin: 0; font-size: 17px; font-weight: 700; color: #0f172a; }
.mreq-modal-close {
  border: none; background: none; font-size: 26px; line-height: 1;
  color: #94a3b8; cursor: pointer; padding: 0 4px;
}
.mreq-modal-close:hover { color: #475569; }
.mreq-modal-body { padding: 18px 20px; overflow-y: auto; }
.mreq-field { margin-bottom: 16px; }
.mreq-label {
  display: block; font-size: 12px; font-weight: 600; color: #475569;
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em;
}
.mreq-input, .mreq-textarea {
  width: 100%; box-sizing: border-box; border: 1px solid #d5dae2;
  border-radius: 9px; padding: 10px 12px; font-size: 14px; color: #0f172a;
  font-family: inherit; resize: vertical;
}
.mreq-input:focus, .mreq-textarea:focus {
  outline: none; border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

/* attachment buttons */
.mreq-attach-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.mreq-attach-btn {
  border: 1px solid #d5dae2; background: #f8fafc; color: #334155;
  border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.mreq-attach-btn:hover { background: #eef2f7; border-color: #c3cbd6; }
.mreq-attach-btn.is-recording {
  background: #fee2e2; border-color: #fca5a5; color: #b91c1c;
}
.mreq-mic-status { margin-top: 8px; font-size: 12px; color: #b91c1c; font-weight: 600; }

/* staged chips */
.mreq-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mreq-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f1f5f9; border-radius: 999px; padding: 4px 6px 4px 10px;
  font-size: 12px; color: #334155; max-width: 100%;
}
.mreq-chip-kind {
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  background: #7c3aed; color: #fff; border-radius: 4px; padding: 1px 5px;
}
.mreq-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.mreq-chip-x {
  border: none; background: none; color: #94a3b8; font-size: 15px;
  cursor: pointer; line-height: 1; padding: 0 2px;
}
.mreq-chip-x:hover { color: #475569; }

/* footer */
.mreq-modal-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-top: 1px solid #eef0f4;
}
.mreq-error { color: #dc2626; font-size: 12.5px; font-weight: 600; margin-right: auto; }
.mreq-btn {
  border-radius: 9px; padding: 9px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
}
.mreq-btn-ghost { background: #fff; border-color: #d5dae2; color: #475569; }
.mreq-btn-ghost:hover { background: #f8fafc; }
.mreq-btn-primary { background: #7c3aed; color: #fff; }
.mreq-btn-primary:hover { background: #6d28d9; }
.mreq-btn-primary:disabled, .mreq-btn-ghost:disabled { opacity: .6; cursor: default; }
.mreq-modal-foot .mreq-error:not(:empty) ~ .mreq-btn { margin-left: 0; }
.mreq-modal-foot .mreq-btn-ghost { margin-left: auto; }

/* deliverable-dashboard actions row holding the "Add manual request" button */
.dd-wd-actions { margin-bottom: 10px; }

/* ── Card entry ────────────────────────────────────────────────────────── */
.mreq-entry {
  border: 1px solid #eceef2; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 12px; background: #fff;
}
.mreq-entry-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.mreq-entry-name { font-weight: 700; font-size: 14px; color: #0f172a; }
.mreq-entry-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: #ede9fe; color: #6d28d9; border-radius: 5px; padding: 2px 7px;
}
.mreq-entry-date { margin-left: auto; font-size: 11.5px; color: #94a3b8; }
.mreq-entry-del {
  border: none; background: none; color: #b91c1c; font-size: 11.5px; font-weight: 600;
  cursor: pointer; padding: 2px 4px;
}
.mreq-entry-del:hover { text-decoration: underline; }
.mreq-entry-del:disabled { opacity: .6; cursor: default; }

/* purple AI summary box — forefront */
.mreq-summary {
  background: #f5f3ff; border: 1px solid #ddd6fe;
  border-left: 4px solid #7c3aed; border-radius: 10px;
  padding: 11px 14px; margin-bottom: 10px;
}
.mreq-summary-label {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: #7c3aed; margin-bottom: 6px;
}
.mreq-summary-list { margin: 0; padding-left: 18px; }
.mreq-summary-list li { font-size: 13.5px; color: #1e1b4b; line-height: 1.5; margin: 2px 0; }
.mreq-summary-text { font-size: 13.5px; color: #1e1b4b; line-height: 1.5; white-space: pre-wrap; }
.mreq-summary-muted { font-size: 13px; color: #8b8ba7; font-style: italic; }
.mreq-summary-loading { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #6d28d9; }

/* spinner */
.mreq-spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(124, 58, 237, .25); border-top-color: #7c3aed;
  display: inline-block; animation: mreq-spin .7s linear infinite;
}
@keyframes mreq-spin { to { transform: rotate(360deg); } }

/* raw body + see more */
.mreq-rawbody { margin-bottom: 10px; }
.mreq-rawbody-label, .mreq-audio-name {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #94a3b8; margin-bottom: 4px;
}
.mreq-rawbody-text { font-size: 13px; color: #334155; line-height: 1.5; white-space: pre-wrap; }
.mreq-seemore {
  border: none; background: none; color: #7c3aed; font-size: 12.5px; font-weight: 600;
  cursor: pointer; padding: 4px 0 0;
}
.mreq-seemore:hover { text-decoration: underline; }

/* attachments */
.mreq-attachments { border-top: 1px dashed #eceef2; padding-top: 10px; }
.mreq-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mreq-thumb {
  width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  border: 1px solid #eceef2; display: block; background: #f8fafc;
}
.mreq-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mreq-audio { margin: 8px 0; padding: 8px 10px; background: #f8fafc; border-radius: 8px; }
.mreq-audio audio { width: 100%; margin-top: 4px; }
.mreq-transcript-loading { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #6d28d9; margin-top: 6px; }
.mreq-transcript-muted { font-size: 12px; color: #94a3b8; font-style: italic; margin-top: 6px; }
.mreq-transcript-toggle {
  border: none; background: none; color: #7c3aed; font-size: 12.5px; font-weight: 600;
  cursor: pointer; padding: 6px 0 0;
}
.mreq-transcript-toggle:hover { text-decoration: underline; }
.mreq-transcript-body {
  margin-top: 6px; font-size: 12.5px; color: #334155; line-height: 1.5;
  white-space: pre-wrap; background: #fff; border: 1px solid #eceef2;
  border-radius: 7px; padding: 8px 10px; max-height: 220px; overflow-y: auto;
}
.mreq-files { display: flex; flex-direction: column; gap: 4px; }
.mreq-file-link { font-size: 13px; color: #7c3aed; text-decoration: none; }
.mreq-file-link:hover { text-decoration: underline; }

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .mreq-modal { max-height: 94vh; border-radius: 12px; }
  .mreq-modal-body { padding: 14px 16px; }
  .mreq-attach-btn { flex: 1 1 auto; text-align: center; }
  .mreq-chip-name { max-width: 140px; }
  .mreq-entry-date { margin-left: 0; width: 100%; }
}

/* ── #134 dark mode overrides ─────────────────────────────── */
/* This file consumes no tokens at all — every surface, border and label is a
   literal, so essentially the whole component needs a dark counterpart.
   The purple AI-summary accent (#7c3aed) is the component's identity and is
   kept, but shifted one or two steps lighter (#a78bfa / #c4b5fd) wherever it
   is used as a FOREGROUND, since #7c3aed only carries ~3:1 on slate. Where it
   backs white text (the chip badge, the primary button) it stays as-is. */

/* ── Modal ─────────────────────────────────────────────────────────────── */
html[data-theme="dark"] .mreq-overlay {
  background: rgba(0, 0, 0, 0.62);
}
html[data-theme="dark"] .mreq-modal {
  background: var(--card-bg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .mreq-modal-head {
  border-bottom-color: var(--ui-border);
}
html[data-theme="dark"] .mreq-modal-title { color: var(--text-primary); }
html[data-theme="dark"] .mreq-modal-close:hover { color: var(--text-primary); }
html[data-theme="dark"] .mreq-label { color: var(--text-muted); }

/* The inputs set a border and a text colour but no background, so in light mode
   they inherit the modal's white. On dark that inherits #1e293b and the field
   stops reading as an input — give it an explicit recessed well. */
html[data-theme="dark"] .mreq-input,
html[data-theme="dark"] .mreq-textarea {
  background: #111c2e;
  border-color: var(--ui-border);
  color: var(--text-primary);
}
html[data-theme="dark"] .mreq-input::placeholder,
html[data-theme="dark"] .mreq-textarea::placeholder {
  color: var(--text-muted);
}
html[data-theme="dark"] .mreq-input:focus,
html[data-theme="dark"] .mreq-textarea:focus {
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.22);
}

/* attachment buttons */
html[data-theme="dark"] .mreq-attach-btn {
  border-color: var(--ui-border);
  background: #273449;
  color: var(--text-secondary);
}
html[data-theme="dark"] .mreq-attach-btn:hover {
  background: #334155;
  border-color: #475569;
}
html[data-theme="dark"] .mreq-attach-btn.is-recording {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}
html[data-theme="dark"] .mreq-mic-status { color: #fca5a5; }

/* staged chips */
html[data-theme="dark"] .mreq-chip {
  background: #273449;
  color: var(--text-secondary);
}
html[data-theme="dark"] .mreq-chip-x:hover { color: var(--text-primary); }

/* footer */
html[data-theme="dark"] .mreq-modal-foot {
  border-top-color: var(--ui-border);
}
html[data-theme="dark"] .mreq-error { color: #fca5a5; }
html[data-theme="dark"] .mreq-btn-ghost {
  background: #273449;
  border-color: var(--ui-border);
  color: var(--text-secondary);
}
html[data-theme="dark"] .mreq-btn-ghost:hover { background: #334155; }
/* The primary keeps its solid purple, but its hover must go LIGHTER on dark —
   #6d28d9 would sink toward the surface instead of lifting off it. */
html[data-theme="dark"] .mreq-btn-primary:hover { background: #8b5cf6; }

/* ── Card entry ────────────────────────────────────────────────────────── */
html[data-theme="dark"] .mreq-entry {
  border-color: var(--ui-border);
  background: #273449;
}
html[data-theme="dark"] .mreq-entry-name { color: var(--text-primary); }
html[data-theme="dark"] .mreq-entry-badge {
  background: rgba(139, 92, 246, 0.20);
  color: #c4b5fd;
}
html[data-theme="dark"] .mreq-entry-del { color: #fca5a5; }

/* purple AI summary box — forefront */
html[data-theme="dark"] .mreq-summary {
  background: rgba(139, 92, 246, 0.13);
  border-color: rgba(139, 92, 246, 0.30);
  border-left-color: #a78bfa;
}
html[data-theme="dark"] .mreq-summary-label { color: #c4b5fd; }
html[data-theme="dark"] .mreq-summary-list li,
html[data-theme="dark"] .mreq-summary-text { color: var(--text-primary); }
html[data-theme="dark"] .mreq-summary-muted { color: var(--text-muted); }
html[data-theme="dark"] .mreq-summary-loading { color: #c4b5fd; }

/* spinner */
html[data-theme="dark"] .mreq-spinner {
  border-color: rgba(167, 139, 250, 0.30);
  border-top-color: #a78bfa;
}

/* raw body + see more */
html[data-theme="dark"] .mreq-rawbody-text { color: var(--text-secondary); }
html[data-theme="dark"] .mreq-seemore { color: #c4b5fd; }

/* attachments */
html[data-theme="dark"] .mreq-attachments { border-top-color: var(--ui-border); }
html[data-theme="dark"] .mreq-thumb {
  border-color: var(--ui-border);
  background: #273449;
}
html[data-theme="dark"] .mreq-audio { background: #273449; }
html[data-theme="dark"] .mreq-transcript-loading { color: #c4b5fd; }
html[data-theme="dark"] .mreq-transcript-toggle { color: #c4b5fd; }
html[data-theme="dark"] .mreq-transcript-body {
  color: var(--text-secondary);
  background: #111c2e;
  border-color: var(--ui-border);
}
html[data-theme="dark"] .mreq-file-link { color: #c4b5fd; }
