/* DocuMind — document-AI extraction (brand dark tokens) */
.docai-intro { text-align: center; max-width: 640px; margin: 6px auto 22px; }
.docai-intro h1 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin: 12px 0 8px; }

.doc-tray { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 22px; }
.doc-chip { display: inline-flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--steel); color: var(--text); border-radius: 12px; padding: 10px 15px; cursor: pointer; font-weight: 600; transition: .15s; }
.doc-chip:hover { border-color: var(--steel-2); transform: translateY(-2px); }
.doc-chip.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.doc-chip .e { font-size: 1.3rem; }

.docai-layout { display: grid; grid-template-columns: 1.25fr .9fr; gap: 20px; align-items: start; }

/* Document stage (the "scanned" page) */
.doc-stage { position: relative; background: var(--surface-2); border: 1px solid var(--steel); border-radius: var(--radius); padding: 22px; overflow: hidden; min-height: 480px; }
.doc-page { background: #fff; color: #18222e; border-radius: 8px; padding: 26px 30px; max-width: 580px; margin-inline: auto; box-shadow: 0 12px 34px rgba(0,0,0,.35); font-family: "Plus Jakarta Sans", sans-serif; font-size: .9rem; line-height: 1.5; }
.scan-line { position: absolute; inset-inline: 22px; top: 22px; height: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); box-shadow: 0 0 18px 3px var(--accent); opacity: 0; pointer-events: none; }
.doc-stage.scanning .scan-line { opacity: 1; animation: docscan 1.15s ease forwards; }
@keyframes docscan { from { transform: translateY(0); } to { transform: translateY(470px); } }

/* Document mark-up */
.d-head { display: flex; align-items: flex-start; gap: 12px; border-bottom: 2px solid #1f2a37; padding-bottom: 12px; }
.d-logo { font-size: 1.9rem; }
.d-co { flex: 1; }
.d-co strong { font-size: 1.02rem; }
.d-sub { color: #5a6b7d; font-size: .8rem; margin-top: 2px; }
.d-tt { font-weight: 800; letter-spacing: .08em; color: #18222e; font-size: .9rem; }
.d-meta { display: flex; gap: 26px; margin-top: 12px; }
.d-meta label, .id-fields label { color: #7a8aa0; font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; margin-inline-end: 4px; }
.d-items { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .82rem; }
.d-items th { text-align: left; color: #7a8aa0; font-size: .7rem; text-transform: uppercase; border-bottom: 1px solid #e3e9f0; padding: 6px 4px; }
.d-items td { padding: 6px 4px; border-bottom: 1px solid #f0f3f7; }
.d-items th:last-child, .d-items td:last-child { text-align: right; }
.d-tot { margin-inline-start: auto; max-width: 240px; }
.d-tot > div { display: flex; justify-content: space-between; padding: 4px 0; }
.d-tot .g { border-top: 2px solid #1f2a37; margin-top: 4px; padding-top: 7px; font-weight: 800; font-size: 1.02rem; }
.d-sign { margin-top: 18px; padding-top: 12px; border-top: 1px dashed #cfd9e6; color: #4a5a6c; }

/* Emirates ID card */
.id-card { background: linear-gradient(135deg, #eef4fb, #dde8f4); border: 1px solid #cdd9e7; border-radius: 12px; padding: 18px; max-width: 440px; margin-inline: auto; }
.id-top { font-weight: 800; color: #2a3b50; font-size: .82rem; letter-spacing: .03em; border-bottom: 1px solid #c2d0e0; padding-bottom: 8px; margin-bottom: 12px; }
.id-row { display: flex; gap: 16px; }
.id-photo { width: 84px; height: 100px; background: #fff; border: 1px solid #c2d0e0; border-radius: 8px; display: grid; place-items: center; font-size: 2.6rem; flex: none; }
.id-fields { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.id-fields > div { display: flex; flex-direction: column; }
.id-fields .two { flex-direction: row; gap: 24px; }

/* Detected fields (AI boxes) */
.doc-page .dfield { transition: background .15s, outline-color .15s; border-radius: 3px; }
.doc-page.detected .dfield { outline: 1.5px solid var(--accent); outline-offset: 2px; background: rgba(59,201,240,.1); position: relative; cursor: pointer; animation: boxin .35s var(--ease); }
.doc-page.detected .dfield.low { outline-color: #d98a1f; background: rgba(242,153,43,.14); }
.doc-page.detected .dfield.hot { background: var(--accent); color: #062430; }
.doc-page.detected .dfield.low.hot { background: #e08a2c; color: #2a1c08; }
.doc-page.detected .dfield::after { content: attr(data-conf) "%"; position: absolute; top: -10px; inset-inline-start: -2px; font-size: .56rem; font-weight: 800; background: var(--accent); color: #062430; padding: 0 4px; border-radius: 4px; opacity: 0; transition: .15s; pointer-events: none; }
.doc-page.detected .dfield.low::after { background: #e08a2c; }
.doc-page.detected .dfield:hover::after, .doc-page.detected .dfield.hot::after { opacity: 1; }
@keyframes boxin { from { opacity: 0; transform: scale(.96); } }

/* Extraction panel */
.extract { background: var(--surface); border: 1px solid var(--steel); border-radius: var(--radius); padding: 16px 18px; position: sticky; top: 84px; }
.ex-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--steel); margin-bottom: 8px; }
.ex-cls { font-size: .92rem; }
.cls-label { color: var(--muted); font-size: .82rem; }
.ex-actions { display: flex; gap: 8px; }
.ex-rows { display: flex; flex-direction: column; gap: 6px; padding-block: 8px; }
.ex-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; transition: .12s; }
.ex-row:hover, .ex-row.hot { border-color: var(--accent); background: rgba(59,201,240,.08); }
.ex-row .k { color: var(--muted); font-size: .82rem; }
.ex-row .v { font-weight: 700; font-size: .9rem; }
.cchip { font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.cchip.ok { background: rgba(52,211,153,.16); color: var(--good); }
.cchip.warn { background: rgba(251,191,36,.18); color: var(--warn); }
.review { font-size: .66rem; font-weight: 800; color: var(--warn); border: 1px solid rgba(251,191,36,.4); border-radius: 999px; padding: 1px 7px; }
.ex-checks { margin-top: 6px; }
.checks-title { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 6px; }
.chk { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: .86rem; }
.chk.ok { color: var(--good); } .chk.bad { color: var(--bad); }
.chk span { color: var(--text); }
.ex-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--steel); margin-top: 10px; padding-top: 12px; color: var(--muted); font-size: .82rem; }
.ex-foot b { color: var(--accent); font-size: 1.15rem; }

.json-out { background: #0a0d12; border: 1px solid var(--steel); border-radius: 10px; padding: 16px; font-family: "Courier New", monospace; font-size: .82rem; color: #cfe8f2; max-height: 360px; overflow: auto; white-space: pre; }

@media (max-width: 900px) {
  .docai-layout { grid-template-columns: 1fr; }
  .extract { position: relative; top: 0; }
  .doc-stage { min-height: 420px; }
}
