/* Phili · Study — soft cream + burgundy, hat-tip to her wine club background */
:root {
  --bg: #f7f1e6;
  --paper: #fffaf0;
  --ink: #1a0a0e;
  --muted: #7a6b62;
  --muted-2: #a59a90;
  --burgundy: #6b1f23;
  --gold: #b8932f;
  --border: rgba(26,10,14,0.10);
  --border-2: rgba(26,10,14,0.18);
  --accent: #b8932f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ─── LOGIN ─── */
.login-shell {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 25% 30%, rgba(107,31,35,0.12), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(184,147,47,0.10), transparent 50%),
    var(--bg);
}
.login-card {
  max-width: 380px; width: 100%;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 32px;
  box-shadow: 0 10px 40px rgba(26,10,14,0.08);
}
.login-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 1px;
  margin: 0 0 6px;
}
.login-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 28px;
}
.login-card input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 14px;
}
.login-card button {
  width: 100%; padding: 12px 14px;
  background: var(--burgundy);
  color: var(--paper);
  border: none;
  border-radius: 8px;
  font-size: 0.95rem; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.5px;
}
.login-card button:hover { opacity: 0.92; }
.login-err {
  color: #b13a3a;
  font-size: 0.85rem;
  margin-top: 12px;
  min-height: 1em;
}

/* ─── APP SHELL ─── */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
}
.brand {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600; font-size: 1.4rem; letter-spacing: 0.5px;
}
.top-right { display: flex; align-items: center; gap: 14px; }
.top-right select {
  padding: 6px 10px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
}
.link {
  background: transparent; border: none;
  color: var(--burgundy); cursor: pointer;
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  padding: 6px 8px;
}
.link:hover { text-decoration: underline; }
.link.tiny { font-size: 0.78rem; opacity: 0.85; }

.tabnav {
  display: flex;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.tabnav-btn {
  background: transparent;
  border: none;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.4px;
}
.tabnav-btn:hover { color: var(--ink); }
.tabnav-btn.active {
  color: var(--burgundy);
  border-bottom-color: var(--burgundy);
}

.main {
  flex: 1; display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 0;
}

/* Photo preview thumbnails (multi-photo) */
.photo-preview { display: flex; flex-direction: column; gap: 10px; }
.preview-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.preview-thumb {
  position: relative;
  width: 90px; height: 90px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-2);
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-thumb .rm {
  position: absolute; top: 2px; right: 2px;
  width: 22px; height: 22px;
  background: rgba(26,10,14,0.65); color: white;
  border: none; border-radius: 50%;
  font-size: 14px; line-height: 22px; padding: 0;
  cursor: pointer;
}
.preview-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Hint shown under photo thumbs */
.preview-hint {
  background: rgba(184,147,47,0.08);
  border: 1px solid rgba(184,147,47,0.28);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}
.preview-hint strong { color: var(--ink); }

/* Review state */
.review-state { display: flex; flex-direction: column; gap: 18px; max-width: 880px; }
.review-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
}
.review-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
}
.review-sub {
  color: var(--muted);
  font-size: 0.86rem;
  font-style: italic;
  margin-top: 4px;
}
.extracted-list { display: flex; flex-direction: column; gap: 14px; }
.extracted-meta {
  font-size: 0.86rem;
  color: var(--muted);
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.extracted-q {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.extracted-q-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--burgundy);
  font-weight: 700;
}
.q-delete { color: var(--muted) !important; }
.q-delete:hover { color: #b13a3a !important; }

.add-question-card {
  margin-top: 4px;
  padding: 18px 16px;
  background: rgba(184,147,47,0.06);
  border: 2px dashed rgba(184,147,47,0.55);
  border-radius: 10px;
  cursor: pointer;
  color: var(--burgundy);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
}
.add-question-card:hover {
  background: rgba(184,147,47,0.12);
  border-color: var(--gold);
}
.add-question-card .add-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: white;
  font-size: 1.2rem; font-weight: 700;
  line-height: 1;
}

.extracted-q.just-added {
  animation: pulseHighlight 1.5s ease-out;
}
@keyframes pulseHighlight {
  0% { box-shadow: 0 0 0 3px var(--gold), 0 0 24px rgba(184,147,47,0.4); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.extracted-q textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.55;
  resize: vertical;
}
.extracted-q .q-text { min-height: 60px; }
.extracted-q .q-inst { min-height: 50px; font-size: 0.88rem; background: rgba(184,147,47,0.04); }
.extracted-q .inst-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

/* Batch pager (when N photos produce N questions) */
.batch-pager {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(184,147,47,0.10);
  border: 1px solid rgba(184,147,47,0.32);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.86rem;
}
.batch-pager span { color: var(--burgundy); font-weight: 600; letter-spacing: 0.5px; }

/* Study tab */
.study-form { max-width: 980px; display: flex; flex-direction: column; gap: 18px; }
.generate-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 800px) {
  .generate-cards { grid-template-columns: 1fr; }
}
.gen-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.gen-card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}
.gen-card-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  margin-top: -8px;
}
.dropzone.compact {
  padding: 28px 16px;
  min-height: 0;
}
.dropzone.compact .dz-icon { font-size: 36px; margin-bottom: 8px; }
.dropzone.compact .dz-title { font-size: 1.05rem; }
.dropzone.compact .dz-sub { font-size: 0.8rem; }
.quiz-nq-row {
  font-size: 0.9rem;
  color: var(--ink);
}
.quiz-nq-row input[type=number] {
  padding: 4px 8px;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  font-family: inherit;
  width: 70px;
  margin-right: 4px;
}
.materials-summary {
  background: rgba(184,147,47,0.08);
  border: 1px solid rgba(184,147,47,0.32);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--ink);
}
.materials-summary.empty {
  background: rgba(177,58,58,0.06);
  border-color: rgba(177,58,58,0.3);
  color: #b13a3a;
}
.study-h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem;
  font-weight: 600;
  margin: 0;
}
.study-kind-row {
  display: flex; align-items: center; gap: 16px;
  font-size: 0.92rem;
  color: var(--ink);
}
.study-kind-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.study-kind-row input[type=number] {
  padding: 4px 8px;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  font-family: inherit;
}
.study-filename {
  font-size: 0.85rem;
  color: var(--burgundy);
  font-weight: 600;
  background: rgba(184,147,47,0.10);
  padding: 8px 12px;
  border-radius: 6px;
}
#study-notes {
  width: 100%;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
}
.guide-viewer, .quiz-viewer { display: flex; flex-direction: column; gap: 18px; max-width: 880px; }
.guide-viewer h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem; font-weight: 600;
  margin: 0 0 4px;
}
.guide-summary {
  background: rgba(184,147,47,0.08);
  border-left: 3px solid var(--gold);
  padding: 12px 16px;
  font-style: italic;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.55;
}
.guide-section h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem; font-weight: 600;
  margin: 18px 0 6px;
  color: var(--burgundy);
}
.guide-body { font-size: 0.95rem; line-height: 1.65; }
.guide-body strong { color: var(--ink); }
.guide-body ul { padding-left: 22px; }
.guide-terms {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
}
.guide-terms h3 {
  font-family: 'Cormorant Garamond', serif;
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: var(--burgundy);
}
.guide-term {
  font-size: 0.92rem;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.guide-term:last-child { border-bottom: none; }
.guide-term .term { font-weight: 700; color: var(--ink); }
.guide-term .def { color: var(--muted); margin-left: 8px; }
.guide-recall {
  background: rgba(107,31,35,0.05);
  border-left: 3px solid var(--burgundy);
  padding: 12px 16px;
}
.guide-recall h3 {
  font-family: 'Cormorant Garamond', serif;
  margin: 0 0 8px;
  color: var(--burgundy);
}
.guide-recall ul { margin: 0; padding-left: 20px; font-size: 0.92rem; }
.guide-recall li { margin-bottom: 4px; }

.quiz-q {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
}
.quiz-q-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--burgundy); font-weight: 700;
  margin-bottom: 8px;
}
.quiz-q-text { font-size: 1rem; line-height: 1.55; margin-bottom: 12px; }
.quiz-choices { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.quiz-choices label {
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
}
.quiz-choices label:hover { background: rgba(184,147,47,0.06); }
.quiz-choices label.correct { border-color: #4a8a4a; background: rgba(74,138,74,0.08); }
.quiz-choices label.wrong { border-color: #b13a3a; background: rgba(177,58,58,0.06); }
.quiz-notes {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 8px;
}
.quiz-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.quiz-answer-box {
  background: rgba(74,138,74,0.08);
  border-left: 3px solid #4a8a4a;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.92rem;
  line-height: 1.55;
  display: none;
}
.quiz-answer-box.show { display: block; }
.quiz-answer-box .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #4a8a4a;
  font-weight: 700;
  margin-bottom: 4px;
}
.quiz-answer-box .explanation { color: var(--muted); margin-top: 4px; font-style: italic; }
.quiz-q.learned { opacity: 0.7; border-color: #4a8a4a; }
.quiz-q.learned::after {
  content: '✓ learned';
  font-size: 0.74rem;
  color: #4a8a4a;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* New: instant-feedback quiz styling */
.quiz-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.quiz-progress {
  font-size: 0.88rem; color: var(--muted);
  font-weight: 600; letter-spacing: 0.5px;
}
.quiz-progress .score { color: var(--burgundy); }
.quiz-choices label.locked { pointer-events: none; cursor: default; }
.quiz-choices input[type=radio] { margin-right: 8px; accent-color: var(--burgundy); }
.quiz-feedback {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 0.92rem;
  display: none;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.right {
  background: rgba(74,138,74,0.10);
  border-left: 3px solid #4a8a4a;
  color: #2d5a2d;
}
.quiz-feedback.wrong {
  background: rgba(177,58,58,0.10);
  border-left: 3px solid #b13a3a;
  color: #7a2424;
}
.quiz-feedback .answer-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin-bottom: 4px;
}
.quiz-feedback .explanation { color: var(--muted); margin-top: 6px; font-style: italic; }

.quiz-summary {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px;
  text-align: center;
}
.quiz-summary .big-score {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3rem;
  font-weight: 600;
  color: var(--burgundy);
  line-height: 1;
}
.quiz-summary .pct { font-size: 1.2rem; color: var(--muted); margin-top: 4px; }
.quiz-summary .actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.quiz-history {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}
.quiz-history-row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  overflow-y: auto;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); font-weight: 700;
  margin-bottom: 14px;
}
.folder-filter {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 12px;
}
.folder-filter .folder-select {
  flex: 1;
  padding: 6px 8px;
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
}
.folder-filter .folder-mgmt {
  font-size: 0.78rem !important;
  white-space: nowrap;
}
.folder-pick-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}
.folder-pick-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}
.folder-pick {
  padding: 6px 10px;
  background: white;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--ink);
}

.folders-list {
  display: flex; flex-direction: column; gap: 8px;
}
.folder-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.folder-row:last-child { border-bottom: none; }
.folder-row .folder-count { color: var(--muted); font-size: 0.78rem; min-width: 60px; text-align: right; }

.sidebar-list { display: flex; flex-direction: column; gap: 4px; }
.sidebar-item {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.86rem;
  border: 1px solid transparent;
}
.sidebar-item:hover { background: rgba(26,10,14,0.04); }
.sidebar-item.active { background: rgba(184,147,47,0.14); border-color: rgba(184,147,47,0.4); }
.sidebar-item .q-snippet { color: var(--muted); font-size: 0.78rem; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.sidebar-item.saved::before { content: '✓ '; color: var(--gold); font-weight: 700; }

/* ─── WORKSPACE ─── */
.workspace {
  padding: 28px 32px;
  overflow-y: auto;
}

.upload-state {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 0;
}
.upload-stack {
  width: 100%; max-width: 620px;
  display: flex; flex-direction: column; gap: 16px;
}
.upload-or {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--muted-2);
}
.upload-or::before, .upload-or::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--border);
}
.upload-type-btn {
  align-self: center;
  padding: 12px 22px !important;
  font-size: 0.92rem;
}
.prompt-row { display: flex; flex-direction: column; gap: 8px; }
.prompt-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--burgundy);
  font-weight: 700;
}
.prompt-label .opt { color: var(--muted-2); font-weight: 500; text-transform: none; letter-spacing: 0; }
#instructions {
  width: 100%;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 76px;
}
#instructions:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 32px;
  width: 100%; max-width: 560px; min-height: 260px;
  border: 2px dashed var(--border-2);
  border-radius: 14px;
  background: var(--paper);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dropzone:hover, .dropzone.drag {
  background: rgba(184,147,47,0.06);
  border-color: var(--gold);
}
.dz-icon { font-size: 56px; margin-bottom: 16px; }
.dz-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem; font-weight: 600;
  margin-bottom: 6px;
}
.dz-sub { color: var(--muted); font-size: 0.88rem; }

.loading-state {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(184,147,47,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--muted); font-style: italic; }

.result-state { display: flex; flex-direction: column; gap: 22px; max-width: 880px; }
.result-section { display: flex; flex-direction: column; gap: 8px; }
.result-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--burgundy); font-weight: 700;
}
.result-text {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.6;
}
.result-text.muted { color: var(--muted); font-style: italic; }
.result-text strong, .result-text b { color: var(--ink); font-weight: 700; }
#answer-body {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: white;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 240px;
}
#answer-body:focus { outline: 2px solid var(--gold); outline-offset: -1px; }

.feedback-row {
  background: rgba(184,147,47,0.06);
  border: 1px solid rgba(184,147,47,0.25);
  border-radius: 8px;
  padding: 14px 16px;
}
.feedback-stack { display: flex; gap: 10px; align-items: flex-start; }
.feedback-stack textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  resize: vertical;
  min-height: 60px;
}
.feedback-stack textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.feedback-stack .btn { flex-shrink: 0; }

.result-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.btn {
  background: var(--burgundy);
  color: var(--paper);
  border: none;
  border-radius: 7px;
  padding: 10px 18px;
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
}
.btn:hover { opacity: 0.92; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-2);
}
.btn.ghost:hover { background: rgba(26,10,14,0.04); }

.status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 18px;
  text-align: right;
}
.status.ok { color: #4a8a4a; }
.status.err { color: #b13a3a; }

/* ─── MODALS ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,10,14,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal {
  background: var(--paper);
  border-radius: 14px;
  max-width: 560px; width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-family: 'Cormorant Garamond', serif; font-weight: 600; margin: 0; font-size: 1.5rem; }
.modal-body { padding: 20px 24px; }
.modal-body .hint { color: var(--muted); font-size: 0.88rem; margin-bottom: 16px; }
.modal-body textarea {
  width: 100%; padding: 12px;
  border: 1px solid var(--border-2);
  border-radius: 7px;
  font-family: inherit; font-size: 0.92rem;
  resize: vertical;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.material-upload {
  display: inline-block;
  cursor: pointer;
  padding: 8px 14px;
  background: var(--burgundy); color: var(--paper);
  border-radius: 6px;
  font-size: 0.86rem; font-weight: 600;
  margin-bottom: 14px;
}
.material-upload:hover { opacity: 0.9; }
.materials-list { display: flex; flex-direction: column; gap: 6px; }
.material-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
}
.material-item .meta { color: var(--muted); font-size: 0.78rem; }

/* ─── MOBILE ─── */
@media (max-width: 760px) {
  .main { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 200px;
  }
  .workspace { padding: 20px 16px; }
  .top { padding: 12px 14px; }
  .top-right { gap: 8px; }
  .top-right select { font-size: 0.85rem; padding: 5px 8px; max-width: 130px; }
  .top-right .link { font-size: 0.82rem; padding: 4px 6px; }
  .brand { font-size: 1.2rem; }
  .dropzone { padding: 36px 20px; }
}
