/* ═══════════════════════════════════════════════════════════
   LAURIE'S AGENT — Quality Manager assistant (Magnaflux)
   Sibling of inventory_agent.css / gap_agent.css. Differs in:
   1) Distinct palette — gold → burnt-amber (gap=navy/amber,
      inventory=teal/emerald)
   2) Two intermixed workflows: PO conformance review + ISO 9001
      vendor survey auto-fill
   3) Chemicals-industry only (gated in laurie_agent.js)

   Positioning note: the toggle lives inside #agentDeck, which owns
   its position/transform via agent_deck.css [data-pos] rules. This
   file only provides the toggle's visual identity (the deck handles
   placement, stacking, and the hover-fan).
   ═══════════════════════════════════════════════════════════ */

/* ── Toggle Button ── */
#laurieToggle {
  position: fixed;
  top: 12px;
  left: 12px;                 /* deck overrides position entirely */
  z-index: 710;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px 7px 12px;
  background: rgba(120, 70, 10, .92);          /* burnt amber — distinct from teal/navy */
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  cursor: pointer;
  transition: all .25s, left 0s;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  font-family: 'DM Sans', sans-serif;
  color: #fff;
}
#laurieToggle:hover {
  border-color: rgba(245, 158, 11, .45);
  box-shadow: 0 6px 28px rgba(0,0,0,.4);
  transform: translateY(-1px);
}

.lau-toggle-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fbbf24, #d97706);  /* gold → amber burn */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}

.lau-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .28);
  border-radius: 16px;
  color: #f59e0b;
  font-size: 12px;
  font-weight: 600;
}


/* ── Panel ── */
#lauriePanel {
  position: fixed;
  top: 58px;
  left: 12px;                 /* JS aligns to the toggle's left edge */
  z-index: 708;
  width: 440px;
  max-height: 0;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 12px 50px rgba(0,0,0,.2), 0 0 0 1px rgba(0,0,0,.06);
  transition: max-height .4s cubic-bezier(.4,0,.2,1), opacity .3s ease;
  opacity: 0;
  display: flex;
  flex-direction: column;
}
#lauriePanel.open {
  max-height: calc(100vh - 74px);
  opacity: 1;
}


/* ── Panel Header ── */
.lau-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, #78350f, #b45309);   /* deep burnt amber */
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-radius: 14px 14px 0 0;
}
.lau-header-left { display: flex; align-items: center; gap: 10px; }
.lau-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.lau-header-title {
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.lau-header-sub {
  font-size: 10px;
  color: rgba(255,255,255,.55);
  margin-top: 1px;
}
.lau-header-right { display: flex; align-items: center; gap: 8px; }
.lau-pulse {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 600; color: #fcd34d; letter-spacing: .03em;
}
.lau-pulse span {
  width: 6px; height: 6px; border-radius: 50%; background: #fcd34d;
  animation: lauPulse 2s ease-in-out infinite;
}
@keyframes lauPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(252,211,77,.4); }
  50% { opacity: .6; box-shadow: 0 0 0 4px rgba(252,211,77,0); }
}
.lau-close-btn {
  width: 26px; height: 26px; border-radius: 6px; border: none;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.6);
  cursor: pointer; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.lau-close-btn:hover { background: rgba(255,255,255,.2); color: #fff; }


/* ── Cycle banner ── */
.lau-cycle {
  padding: 10px 16px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  font-size: 11px;
  color: #92400e;
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.lau-cycle i { color: #d97706; }
.lau-cycle strong { color: #78350f; font-weight: 700; }


/* ── Body (log list) ── */
.lau-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  scroll-behavior: smooth;
}
.lau-body::-webkit-scrollbar { width: 4px; }
.lau-body::-webkit-scrollbar-track { background: transparent; }
.lau-body::-webkit-scrollbar-thumb { background: #fcd34d; border-radius: 2px; }


/* ── Log Entry (a PO-review or survey card) ── */
.lau-log {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 13px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: all .2s;
  animation: lauFadeIn .35s ease both;
}
.lau-log:hover {
  border-color: #f59e0b;
  box-shadow: 0 4px 14px rgba(245,158,11,.12);
}
@keyframes lauFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.lau-log-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  color: #d97706;
}
/* Type variants — PO vs survey */
.lau-log.kind-po     .lau-log-icon { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8 }
.lau-log.kind-survey .lau-log-icon { background:#f0fdf4; border-color:#bbf7d0; color:#15803d }
.lau-log.flagged     .lau-log-icon { background:#fef2f2; border-color:#fecaca; color:#b91c1c }

.lau-log-body { flex: 1; min-width: 0; }
.lau-log-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px; flex-wrap: wrap;
}
.lau-log-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 1px 7px; border-radius: 4px;
}
.lau-log.kind-po     .lau-log-tag { background:#dbeafe; color:#1d4ed8 }
.lau-log.kind-survey .lau-log-tag { background:#dcfce7; color:#166534 }
.lau-log.flagged     .lau-log-tag { background:#fee2e2; color:#991b1b }

.lau-log-ref {
  font-size: 10.5px; font-weight: 600; color: #64748b; letter-spacing: .03em;
}
.lau-log-text {
  font-size: 12.5px; line-height: 1.5; color: #334155;
}
.lau-log-text strong { color: #0f172a; font-weight: 600; }

.lau-log-actions { margin-top: 10px; display: flex; gap: 6px; }

/* Investigate button (flagged items) */
.lau-log-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: #d97706; color: #fff; border: none; border-radius: 6px;
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.lau-log-btn:hover {
  background: #b45309; transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(217,119,6,.3);
}
.lau-log-btn.investigated { background: #f59e0b; cursor: default; }
.lau-log-btn.investigated:hover { transform: none; }

/* Passive status chip (auto-verified / auto-filled) */
.lau-log-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: #f0fdf4; color: #15803d;
  border: 1px solid #bbf7d0; border-radius: 6px;
  font-family: 'DM Sans', sans-serif; font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; user-select: none;
}
.lau-log-chip i { font-size: 10px; color: #16a34a; }

/* Subtle lift on flagged cards so the eye finds the action items */
.lau-log.flagged {
  border-color: #fecaca;
  box-shadow: 0 1px 0 rgba(185,28,28,.04);
}


/* ═══════════════════════════════════════════════════════════
   INVESTIGATION CHAT CARDS (rendered in #laurieMsgs ext-tab pane)
   ═══════════════════════════════════════════════════════════ */

.lau-chat-card {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 8px;
}
.lau-chat-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.lau-chat-header i { color: #d97706; font-size: 14px; }
.lau-chat-header strong { font-size: 14px; color: #78350f; }

/* PO detail grid */
.lau-chat-po {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 10px 12px; background: #fff; border: 1px solid #fde68a;
  border-radius: 8px; margin-bottom: 12px;
}
.lau-chat-po-field { font-size: 11px; }
.lau-chat-po-label {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: #92400e; opacity: .8;
}
.lau-chat-po-value { font-weight: 500; color: #78350f; margin-top: 1px; }
/* the deviating field, highlighted */
.lau-chat-po-field.deviation .lau-chat-po-value { color: #b91c1c; font-weight: 700; }
.lau-chat-po-field.deviation .lau-chat-po-label { color: #b91c1c; }

.lau-chat-analysis {
  font-size: 12.5px; line-height: 1.6; color: #451a03;
  white-space: pre-wrap; margin-top: 6px;
}
.lau-chat-analysis strong { color: #78350f; font-weight: 700; }

/* Yes/No verification buttons inside the chat card */
.lau-verify-row {
  display: flex; gap: 10px; margin-top: 14px;
}
.lau-verify-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 9px; border: 1.5px solid;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.lau-verify-yes {
  background: #f0fdf4; border-color: #86efac; color: #15803d;
}
.lau-verify-yes:hover { background: #dcfce7; transform: translateY(-1px); box-shadow: 0 3px 12px rgba(22,163,74,.2); }
.lau-verify-no {
  background: #fef2f2; border-color: #fca5a5; color: #b91c1c;
}
.lau-verify-no:hover { background: #fee2e2; transform: translateY(-1px); box-shadow: 0 3px 12px rgba(185,28,28,.2); }
.lau-verify-btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }


/* ── Survey table card ── */
.lau-survey-card {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 8px;
}
.lau-survey-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #fde68a;
  margin: 4px 0 12px;
}
.lau-survey-table th {
  text-align: left;
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: #92400e;
  padding: 8px 10px; background: #fffbeb; border-bottom: 1px solid #fde68a;
}
.lau-survey-table td {
  padding: 7px 10px; font-size: 12px; color: #451a03;
  border-bottom: 1px solid #fef3c7; vertical-align: middle;
}
.lau-survey-table tr:last-child td { border-bottom: none; }
.lau-survey-field-label { font-weight: 600; color: #78350f; }
.lau-survey-input {
  width: 100%;
  font-family: 'DM Sans', sans-serif; font-size: 12px; color: #451a03;
  padding: 6px 8px;
  border: 1px solid #fde68a; border-radius: 6px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.lau-survey-input:focus {
  outline: none; border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217,119,6,.15);
}
/* prefilled fields read as settled (greenish check), blank ones invite input */
.lau-survey-input.prefilled { background: #f0fdf4; border-color: #bbf7d0; }
.lau-survey-row.blank .lau-survey-field-label { color: #b45309; }
.lau-survey-status {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; white-space: nowrap;
}
.lau-survey-status.ok    { background:#dcfce7; color:#166534 }
.lau-survey-status.need  { background:#fef3c7; color:#92400e }

.lau-survey-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 10px 16px; margin-top: 4px;
  background: #d97706; color: #fff; border: none; border-radius: 9px;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.lau-survey-submit:hover { background: #b45309; transform: translateY(-1px); box-shadow: 0 3px 12px rgba(217,119,6,.3); }
.lau-survey-submit:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }


/* ── Drafted email block (shown after a 'No' verification) ── */
.lau-email-draft {
  background: #fff;
  border: 1px solid #fde68a;
  border-left: 3px solid #d97706;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #451a03;
}
.lau-email-draft-label {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #d97706; margin-bottom: 6px; display: block;
}
.lau-email-field { margin-bottom: 4px; }
.lau-email-field .k { font-weight: 700; color: #78350f; }
.lau-email-body { margin-top: 8px; white-space: pre-wrap; }


/* ═══════════════════════════════════════════════════════════
   EXTENSION PANEL — LAURIE TAB STYLING
   ═══════════════════════════════════════════════════════════ */
.ep-tab[data-tab="laurie"].active {
  border-bottom-color: #d97706;
  color: #78350f;
}
.ep-tab[data-tab="laurie"] i { color: #d97706; }
.ep-tab[data-tab="laurie"] .ep-tab-dot,
.ep-tab .laurie-dot { background: #d97706; }