/* Design system carried over from the original DPRflow admin panel for
   visual continuity, extended with a login screen and a few new components
   (audio player, review badges) needed by the voice check-in module. */
:root {
  --primary: #065f46; --primary-light: #d1fae5; --primary-mid: #10b981;
  --purple: #7c3aed; --purple-light: #ede9fe;
  --blue: #1e3a8a; --blue-light: #dbeafe;
  --yellow: #92400e; --yellow-light: #fef3c7;
  --red: #991b1b; --red-light: #fee2e2;
  --gray: #334155; --gray-light: #f1f5f9; --border: #e2e8f0;
  --white: #ffffff; --shadow: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f8fafc; color: var(--gray); font-size: 14px; }

/* ===== LOGIN (docuXray VoiceDPR split-screen) ===== */
.login-screen {
  --login-deep: #0b3d2e;
  --login-deep-2: #0f4d33;
  --login-accent: #34d399;
  --login-accent-soft: #6ee7b7;
  --login-cta: #0f4d33;
  --login-muted: #6b7280;
  --login-border: #e5e7eb;
  --login-font: 'Plus Jakarta Sans', system-ui, sans-serif;

  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  background: #fff;
  font-family: var(--login-font);
}

.login-brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px 36px;
  color: #fff;
  background:
    radial-gradient(ellipse 80% 60% at 50% 70%, rgba(52, 211, 153, 0.22), transparent 60%),
    linear-gradient(165deg, #06291f 0%, var(--login-deep) 45%, var(--login-deep-2) 100%);
}

.login-brand-glow {
  position: absolute;
  inset: auto -20% -30% -20%;
  height: 55%;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(16, 185, 129, 0.35), transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(52, 211, 153, 0.25), transparent 45%);
  pointer-events: none;
}

.login-brand-mesh {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background:
    repeating-linear-gradient(
      105deg,
      transparent 0 10px,
      rgba(110, 231, 183, 0.04) 10px 11px
    ),
    linear-gradient(180deg, transparent, rgba(6, 41, 31, 0.55));
  mask-image: linear-gradient(180deg, transparent 0%, #000 40%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 40%);
  pointer-events: none;
}

.login-brand-mesh::after {
  content: '';
  position: absolute;
  inset: 20% -10% -20%;
  background:
    radial-gradient(ellipse 120% 80% at 50% 100%, rgba(52, 211, 153, 0.35), transparent 55%);
  opacity: 0.9;
}

.login-brand-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  max-width: 560px;
}

.login-logo-mark {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #064e3b, #022c22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(110, 231, 183, 0.2);
}

.login-brand-title {
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: #fff;
  margin: 0 0 8px;
}

.login-brand-title span {
  color: var(--login-accent);
}

.login-brand-tagline {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
  color: rgba(236, 253, 245, 0.78);
}

.login-hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
  min-height: 220px;
}

.login-hero-svg {
  width: min(100%, 520px);
  height: auto;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.25));
  animation: loginHeroFloat 6s ease-in-out infinite;
}

@keyframes loginHeroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-features {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-top: 8px;
}

.login-feature {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.login-feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(6, 78, 59, 0.65);
  border: 1px solid rgba(110, 231, 183, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.login-feature span {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  color: rgba(236, 253, 245, 0.92);
  max-width: 140px;
}

.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: #fff;
}

.login-form {
  width: 100%;
  max-width: 400px;
}

.login-form-header {
  margin-bottom: 28px;
}

.login-form-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #111827;
  margin: 0 0 8px;
}

.login-form-header p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--login-muted);
}

.login-field {
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 8px;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 14px;
  color: #9ca3af;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.login-input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 44px;
  border: 1.5px solid var(--login-border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input-wrap input::placeholder {
  color: #9ca3af;
  font-weight: 500;
}

.login-input-wrap input:focus {
  outline: none;
  border-color: var(--login-accent);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.15);
}

.login-toggle-pass {
  position: absolute;
  right: 8px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: #9ca3af;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.login-toggle-pass:hover {
  color: #4b5563;
  background: #f3f4f6;
}

.login-field-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.login-forgot {
  font-size: 0.85rem;
  font-weight: 600;
  color: #059669;
  text-decoration: none;
}

.login-forgot:hover {
  color: #047857;
  text-decoration: underline;
}

.login-error {
  min-height: 18px;
  margin: 4px 0 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #dc2626;
}

.login-error.is-info {
  color: #047857;
}

.login-submit {
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 12px;
  background: var(--login-cta);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 77, 51, 0.28);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}

.login-submit:hover {
  background: #0a3d28;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 77, 51, 0.32);
}

.login-submit:active {
  transform: translateY(0);
}

.login-submit svg {
  margin-left: auto;
  margin-right: 4px;
}

.login-submit span {
  flex: 1;
  text-align: center;
  padding-left: 22px; /* optical center with arrow on right */
}

.login-secure {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #9ca3af;
  font-size: 0.78rem;
  font-weight: 500;
}

@media (max-width: 900px) {
  .login-screen {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .login-brand-panel {
    padding: 28px 24px 20px;
    min-height: auto;
  }

  .login-hero {
    display: none;
  }

  .login-features {
    display: none;
  }

  .login-brand-top {
    max-width: none;
  }

  .login-brand-title {
    font-size: 1.35rem;
  }

  .login-brand-tagline {
    font-size: 0.85rem;
  }

  .login-form-panel {
    padding: 32px 20px 40px;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-hero-svg {
    animation: none;
  }
}

/* ===== NAV ===== */
.navbar { background: var(--primary); color: white; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; height: 56px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.navbar .brand { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.navbar .brand span { color: var(--primary-mid); }
.navbar .project-badge { background: rgba(255,255,255,.12); padding: 4px 12px; border-radius: 20px; font-size: 12px; }

/* ===== STEPPER / NAV TABS ===== */
.stepper { background: white; border-bottom: 1px solid var(--border); padding: 0 28px; display: flex; gap: 0; overflow-x: auto; }
.step { display: flex; align-items: center; padding: 16px 20px 14px; cursor: pointer; border-bottom: 3px solid transparent; gap: 10px; white-space: nowrap; transition: all .15s; color: #94a3b8; }
.step:hover { color: var(--gray); }
.step.active { border-bottom-color: var(--primary-mid); color: var(--primary); }
.step-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: #e2e8f0; color: #64748b; }
.step.active .step-num { background: var(--primary-mid); color: white; }
.step-label { font-size: 13px; font-weight: 600; }
.step-sub { font-size: 11px; margin-top: 1px; }
.step-arrow { color: #e2e8f0; font-size: 18px; align-self: center; padding: 0 2px; }

/* ===== CONTENT ===== */
.content { max-width: 1200px; margin: 0 auto; padding: 28px; }
.panel { background: white; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.panel-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.panel-header h2 { font-size: 16px; font-weight: 700; }
.panel-header p { font-size: 12px; color: #64748b; margin-top: 2px; }
.panel-body { padding: 24px; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-new { background: var(--primary-mid); color: white; }
.badge-auto { background: var(--purple); color: white; }
.badge-green { background: var(--primary-light); color: var(--primary); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--gray-light); color: #475569; }
.badge-purple { background: var(--purple-light); color: var(--purple); }

/* ===== TABLES ===== */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #64748b; background: #f8fafc; border-bottom: 1px solid var(--border); }
td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.flag-row td { background: #fff7ed; }
tr.flag-row td:first-child { border-left: 3px solid #f59e0b; }
tr.ok-row td { background: #f0fdf4; }
tr.ok-row td:first-child { border-left: 3px solid var(--primary-mid); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fafc; }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span2 { grid-column: span 2; }
label { font-size: 12px; font-weight: 600; color: #475569; }
input, select, textarea { border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 13px; width: 100%; font-family: inherit; background: white; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-mid); box-shadow: 0 0 0 3px rgba(16,185,129,.1); }

/* ===== BUTTONS ===== */
.btn { padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--primary-mid); color: white; }
.btn-primary:hover { background: #059669; }
.btn-secondary { background: var(--gray-light); color: var(--gray); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-purple { background: var(--purple); color: white; }
.btn-blue { background: #1d4ed8; color: white; }
.btn-red { background: #dc2626; color: white; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== STAT CARDS ===== */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: #64748b; margin-top: 2px; }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.alert-yellow { background: var(--yellow-light); border: 1px solid #fcd34d; color: var(--yellow); }
.alert-green { background: var(--primary-light); border: 1px solid #6ee7b7; color: var(--primary); }
.alert-blue { background: var(--blue-light); border: 1px solid #93c5fd; color: var(--blue); }
.alert-purple { background: var(--purple-light); border: 1px solid #c4b5fd; color: var(--purple); }

/* ===== MISC ===== */
.section-title { font-size: 13px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 14px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.text-muted { color: #94a3b8; font-size: 12px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.inline-edit { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; width: 90px; font-size: 13px; }
.chip { display: inline-block; background: var(--gray-light); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; color: #475569; margin-right: 4px; }
.workflow-arrow { background: var(--primary-light); border-radius: 8px; padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--primary); display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }

/* ===== VOICE-SPECIFIC ADDITIONS ===== */
.qa-block { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.qa-question { font-size: 12px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.qa-transcript { font-size: 14px; line-height: 1.6; color: var(--gray); margin: 8px 0 12px; padding: 12px 14px; background: #f8fafc; border-radius: 8px; border-left: 3px solid var(--primary-mid); }
.qa-transcript.low-confidence { border-left-color: #f59e0b; background: #fffbeb; }
.qa-lang-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); margin-bottom: 8px; }
.qa-transcript-original, .qa-transcript-english { margin-top: 8px; line-height: 1.55; }
.qa-transcript-tag { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--primary-mid); margin-right: 6px; }
.qa-transcript-english { color: var(--gray); }
.qa-extracted { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.qa-extracted .chip { background: var(--primary-light); color: var(--primary); }
audio { width: 100%; height: 36px; margin: 6px 0; }
.confidence-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 10px; }
.confidence-high { background: var(--primary-light); color: var(--primary); }
.confidence-low { background: var(--yellow-light); color: var(--yellow); }

/* ===== QUESTIONS TAB ===== */
.add-question-panel { display: flex; flex-direction: column; gap: 12px; }
.add-question-label { font-size: 12px; font-weight: 600; color: #475569; }
.add-question-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  user-select: none;
  transition: background .15s, border-color .15s;
}
.checkbox-pill:hover { background: #f1f5f9; }
.checkbox-pill input { width: 16px; height: 16px; accent-color: var(--primary-mid); cursor: pointer; margin: 0; }
.checkbox-pill-sm { padding: 6px 12px; font-size: 12px; }

.questions-list { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.questions-empty {
  padding: 40px 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
}

.question-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 18px 20px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: box-shadow .15s, border-color .15s;
}
.question-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.question-card-inactive { opacity: .72; background: #f8fafc; }

.question-card-num {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 22px;
}

.question-card-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.question-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #94a3b8;
}
.question-card .q-prompt {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  line-height: 1.5;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  transition: border-color .15s, box-shadow .15s;
}
.question-card .q-prompt:focus {
  outline: none;
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(16,185,129,.1);
}

.question-card-toggles { display: flex; flex-wrap: wrap; gap: 8px; }

.question-card-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 108px;
  padding-top: 22px;
}
.question-reorder {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--gray-light); color: var(--gray); border-color: #cbd5e1; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

.question-delete-btn { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.question-delete-btn:hover { background: #fee2e2; border-color: #fca5a5; }

@media (max-width: 768px) {
  .question-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .question-card-num { margin-top: 0; }
  .question-card-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 0;
    min-width: 0;
  }
  .question-reorder { margin-right: auto; }
  .add-question-footer { flex-direction: column; align-items: stretch; }
  .add-question-footer .btn { justify-content: center; }
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(16px);
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--gray);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  max-width: min(92vw, 420px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-success {
  border-color: #6ee7b7;
  background: var(--primary-light);
  color: var(--primary);
}
.toast-warn {
  border-color: #fcd34d;
  background: var(--yellow-light);
  color: var(--yellow);
}
.toast-error {
  border-color: #fca5a5;
  background: var(--red-light);
  color: var(--red);
}
