/* GLF QME Cloud — shared styles
 * Color tokens copied from qme-standalone/templates/index.html so the cloud
 * UI matches the desktop tool visually. Keep these in sync if the desktop
 * tool's palette ever shifts.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #333F3F;
  --navy2:   #2a3535;
  --blue:    #A41B20;
  --blue2:   #c02228;
  --gold:    #A41B20;
  --gold2:   #c02228;
  --red:     #A41B20;
  --red2:    #c02228;
  --red-bg:  #fef2f1;
  --green:   #27ae60;
  --green-bg:#f0faf4;
  --orange:  #e67e22;
  --gray-bg: #F4F4F4;
  --border:  #dce3ed;
  --text:    #1a2332;
  --text2:   #4a5568;
  --text3:   #718096;
  --shadow:  0 2px 12px rgba(51,63,63,0.10);
  --radius:  8px;
  --font:    -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  --mono:    'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--gray-bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  background: linear-gradient(135deg, #222c2c 0%, #333F3F 60%, #2a3535 100%);
  color: #fff;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.topbar .title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.topbar .subtitle {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  margin-top: 1px;
}
.topbar nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  margin-left: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.topbar nav a:hover { color: #fff; }
.topbar nav a.active { color: #fff; border-bottom: 2px solid var(--blue); padding-bottom: 2px; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

/* ── Headings & text ─────────────────────────────────────────────────── */
h1 { color: var(--navy); font-size: 1.3rem; margin-bottom: 0.5rem; }
h2 { color: var(--navy); font-size: 1.05rem; margin: 1rem 0 0.5rem; }
p  { font-size: 0.9rem; color: var(--text2); margin-bottom: 0.5rem; }

/* ── Sections (collapsible-ish) ──────────────────────────────────────── */
.section {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden;
}
.section-header {
  background: linear-gradient(135deg, #f0f4f9 0%, #e8edf4 100%);
  padding: 0.7rem 1rem;
  font-size: 0.95rem; font-weight: 700;
  color: var(--navy); letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.section-body { padding: 1rem; }

/* ── Form fields ─────────────────────────────────────────────────────── */
.field-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }
.field-group { display: flex; flex-direction: column; margin-bottom: 0.7rem; position: relative; }
.field-group.full { grid-column: 1 / -1; }
.field-group label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text2);
  margin-bottom: 0.25rem;
  display: flex; align-items: center; gap: 0.35rem;
}
.field-group .req { color: var(--red); }
.field-group input, .field-group select, .field-group textarea {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
  background: #fff; color: var(--text);
  transition: border 0.15s;
}
.field-group input:focus, .field-group select:focus, .field-group textarea:focus {
  outline: none; border-color: var(--blue);
}
.field-group textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; padding: 0.55rem 1.1rem;
  border: none; border-radius: 6px;
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue2) 100%);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--blue2) 0%, #8c1519 100%);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--gray-bg); color: var(--text2);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: #e8ecf3; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--navy2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red2); }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Status pills ────────────────────────────────────────────────────── */
.pill {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.pill-draft     { background: #f3f4f6; color: #6b7280; }
.pill-queued    { background: #dbeafe; color: #1d4ed8; }
.pill-claimed   { background: #fef3c7; color: #92400e; }
.pill-running   { background: #fde68a; color: #92400e; }
.pill-succeeded { background: #dcfce7; color: #15803d; }
.pill-failed    { background: var(--red-bg); color: var(--red); }
.pill-cancelled { background: #f3f4f6; color: #4b5563; }
.pill-needs_review { background: #fef3c7; color: #b45309; border: 1px solid #f59e0b; }

/* ── Result banners ──────────────────────────────────────────────────── */
.banner {
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.banner .banner-title {
  font-weight: 700; font-size: 0.95rem; margin-bottom: 0.25rem;
  letter-spacing: 0.02em;
}
.banner-success { background: var(--green-bg); border-color: #b7e4c7; color: #15803d; }
.banner-warn    { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
.banner-danger  { background: var(--red-bg); border-color: #f3b3b1; color: var(--red); }

/* Verified badge */
.vbadge {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.vbadge-success   { background: #dcfce7; color: #15803d; }
.vbadge-uncertain { background: #fef3c7; color: #b45309; }
.vbadge-none      { background: #f3f4f6; color: #6b7280; }

/* Captured panel page text */
.panel-html {
  font-family: var(--mono); font-size: 0.72rem;
  background: #fafbfd; border: 1px solid var(--border);
  border-radius: 6px; padding: 0.75rem;
  white-space: pre-wrap; word-break: break-word;
  max-height: 320px; overflow: auto; color: var(--text2);
}
.pdf-list { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.pdf-list li {
  font-family: var(--mono); font-size: 0.78rem; color: var(--text2);
  padding: 0.15rem 0;
}
.pdf-list li::before { content: "📄 "; }

/* Live-stream paused notice */
.stream-notice {
  background: #fef3c7; border: 1px solid #f59e0b; color: #92400e;
  border-radius: 6px; padding: 0.55rem 0.8rem; margin-bottom: 0.6rem;
  font-size: 0.82rem; display: flex; align-items: center;
  justify-content: space-between; gap: 0.75rem;
}

/* ── Tables ──────────────────────────────────────────────────────────── */
table.list {
  width: 100%; border-collapse: collapse;
  background: #fff; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
table.list th, table.list td {
  padding: 0.6rem 0.85rem; text-align: left;
  font-size: 0.85rem; border-bottom: 1px solid var(--border);
}
table.list th {
  background: var(--navy); color: #fff;
  font-weight: 600; font-size: 0.78rem;
  letter-spacing: 0.04em; text-transform: uppercase;
}
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover { background: #f8fafc; cursor: pointer; }

/* ── Login page ──────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #222c2c 0%, #333F3F 60%, #2a3535 100%);
}
.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  padding: 2rem 2.25rem; width: 100%; max-width: 380px;
  text-align: center;
}
.login-card h1 { text-align: center; font-size: 1.15rem; }
.login-card .sub { font-size: 0.8rem; color: var(--text3); margin-bottom: 1.2rem; }
.login-card input[type="password"] {
  width: 100%; padding: 0.65rem 0.8rem;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.92rem; margin-bottom: 0.8rem;
}
.login-card button { width: 100%; }
.login-card .err {
  color: var(--red); font-size: 0.82rem; margin-top: 0.7rem;
  background: var(--red-bg); padding: 0.5rem; border-radius: 6px;
}

/* ── Firm autocomplete dropdown ──────────────────────────────────────── */
.firm-typeahead {
  position: relative;
  width: 100%;
}
.firm-typeahead input {
  width: 100%;
  box-sizing: border-box;
}
.firm-suggestions {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 6px 6px;
  max-height: 240px; overflow-y: auto;
  z-index: 20; box-shadow: var(--shadow);
}
.firm-suggestion {
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.firm-suggestion:hover { background: #f0f5ff; }
.firm-suggestion:last-child { border-bottom: none; }
.firm-suggestion .firm-name { font-weight: 600; color: var(--navy); }
.firm-suggestion .firm-meta { font-size: 0.72rem; color: var(--text3); }
.firm-add-row {
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem; color: var(--blue);
  font-weight: 600; cursor: pointer;
  background: #fafbfd; border-top: 1px solid var(--border);
}
.firm-add-row:hover { background: #f0f5ff; }

/* ── Add-firm modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,35,50,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff; border-radius: var(--radius);
  padding: 1.25rem 1.5rem; width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}
.modal h2 { margin-top: 0; }

/* ── Event log ───────────────────────────────────────────────────────── */
.event-log {
  font-family: var(--mono); font-size: 0.78rem;
  background: #1a2332; color: #d3dde9;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  max-height: 420px; overflow-y: auto;
  line-height: 1.5;
}
.event-log .ev    { margin-bottom: 0.15rem; }
.event-log .ev .ts { color: #718096; margin-right: 0.5rem; }
.event-log .ev .lvl { display: inline-block; min-width: 3.5em; font-weight: 700; margin-right: 0.5rem; }
.event-log .ev.info .lvl  { color: #93c5fd; }
.event-log .ev.ok .lvl    { color: #6ee7b7; }
.event-log .ev.warn .lvl  { color: #fbbf24; }
.event-log .ev.err .lvl   { color: #fca5a5; }
.event-log .ev .step      { color: #c4b5fd; margin-right: 0.5rem; }

/* ── Drop zone ──────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--text3);
  font-size: 0.88rem;
  background: #fafbfd;
  cursor: pointer;
  transition: all 0.15s;
}
.dropzone:hover { border-color: var(--blue); background: #fff6f6; }
.dropzone.drag  { border-color: var(--red); background: var(--red-bg); }
.dropzone .file { color: var(--navy); font-weight: 600; }

/* ── Notifications ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--navy); color: #fff;
  padding: 0.7rem 1.1rem; border-radius: 6px;
  box-shadow: var(--shadow); font-size: 0.85rem;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err  { background: var(--red); }
.toast.ok   { background: var(--green); }

/* ── Empty state ─────────────────────────────────────────────────────── */
.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text3);
  font-size: 0.9rem;
}

/* Firm autocomplete source badges (saved dictionary vs live DWC database) */
.firm-src { font-size: 0.62rem; font-weight: 600; padding: 0.05rem 0.3rem; border-radius: 3px;
  background: #e2e8f0; color: #4a5568; vertical-align: middle; margin-left: 0.3rem; }
.firm-src-dwc { background: #c6d7f0; color: #1e3a5f; }
.firm-loading { font-style: italic; }
