/* Beble look, the same palette and shapes as the WeeCore dashboard.
   Montserrat is served from this site (fonts/), so no page of the portal calls another host. */

@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/montserrat-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/montserrat-latin-700-normal.woff2") format("woff2"); }

:root {
  --primary: #1a3fc4;
  --primary-light: #4a90d9;
  --primary-dark: #1230a0;
  --header: #2b7be5;
  --bg: #f5f5f5;
  --card: #ffffff;
  --ink: #212121;
  --muted: #5f6b7a;
  --line: #e0e0e0;
  --soft: #eef3fd;
  --ok: #0b7a35;
  --ok-bg: #e8f7ee;
  --warn: #b45309;
  --warn-bg: #fff4e5;
  --bad: #d32f2f;
  --bad-bg: #fdecec;
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .1);
  --side: 232px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Shell: dark blue side bar + content, as in WeeCore */

.shell { display: flex; min-height: 100vh; }

.side {
  position: sticky;
  top: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  width: var(--side);
  min-height: 100vh;
  max-height: 100vh;
  flex-shrink: 0;
  background: var(--primary-dark);
  color: #fff;
}

.brand { display: flex; flex-direction: column; gap: 6px; padding: 20px 20px 16px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.brand img { display: block; width: 130px; height: auto; }
.brand-name { font-size: .78rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }

.tabs { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; flex: 1; overflow-y: auto; }
.tabs button {
  width: 100%;
  padding: 11px 20px;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: 0;
  background: none;
  color: rgba(255, 255, 255, .82);
  font-weight: 500;
  text-align: left;
}
.tabs button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.tabs button[aria-current="page"] { background: rgba(255, 255, 255, .16); border-left-color: var(--primary-light); color: #fff; font-weight: 600; }
.tabs button:focus-visible { outline-color: #fff; outline-offset: -3px; }

.session { display: flex; flex-direction: column; gap: 6px; padding: 14px 20px 18px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .82rem; color: rgba(255, 255, 255, .8); }
#who { word-break: break-word; }
.session button.link { align-self: flex-start; color: #fff; font-weight: 600; }

main { flex: 1; min-width: 0; max-width: 1100px; margin: 0 auto; padding: 28px 28px 48px; }

/* Cards and forms */

.card {
  background: var(--card);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 20px;
}

.card h2, .card h3 { margin-top: 0; color: var(--primary); font-weight: 700; }
.card h2 { font-size: 1.2rem; }
.card h3 { font-size: 1rem; margin-top: 22px; }
.narrow { max-width: 420px; margin: 56px auto; }

label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .86rem; color: var(--ink); }
label.inline { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; font-size: .9rem; }
.client-line { margin: 0 0 14px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--soft); color: var(--primary-dark); }

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

input:focus, select:focus, textarea:focus { border-color: var(--primary-light); }
input[type="checkbox"] { width: auto; margin-top: 4px; accent-color: var(--primary); }
textarea { min-height: 70px; resize: vertical; }

button {
  font: inherit;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

button:hover { background: var(--soft); }
button.primary { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
button.wide { width: 100%; padding: 11px 16px; }
button.link { border: 0; background: none; color: var(--primary); padding: 0; text-decoration: underline; }
button.link:hover { background: none; text-decoration: none; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad-bg); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 14px; }
.toolbar label { margin: 0; min-width: 200px; }

.message { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-sm); }
.message.error { border-color: var(--bad); background: var(--bad-bg); color: #b71c1c; }
.message.success { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }

/* Tables */

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--primary); font-weight: 700; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; background: var(--soft); }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.clickable:focus-visible { background: var(--soft); }
.table-wrap { overflow-x: auto; }
td select { margin-top: 0; min-width: 160px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; border: 1px solid currentColor; }
.sat-hit { margin-bottom: 12px; }
.sat-hit table th { width: 40%; text-align: left; background: var(--primary); color: #fff; text-transform: none; font-size: .8rem; letter-spacing: 0; }
.badge.pending { color: var(--warn); background: var(--warn-bg); }
.badge.valid { color: var(--ok); background: var(--ok-bg); }
.badge.not_valid, .badge.not_found, .badge.mismatch { color: var(--bad); background: var(--bad-bg); }

/* Detail of a request */

.data-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.data-row .name { min-width: 190px; color: var(--muted); }
.data-row code { font-size: 1.02rem; padding: 3px 10px; background: var(--soft); color: var(--primary-dark); border: 1px solid #d3def7; border-radius: var(--radius-sm); }

.steps { margin: 12px 0; padding-left: 20px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.key-box { padding: 14px; border: 2px dashed var(--warn); border-radius: var(--radius-md); background: var(--warn-bg); margin: 12px 0; word-break: break-all; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }

a.button { display: inline-block; padding: 9px 16px; border: 1px solid var(--primary); border-radius: var(--radius-sm); background: var(--primary); color: #fff; font-weight: 600; text-decoration: none; }
a.button:hover { background: var(--primary-dark); }
.photo-box img { display: block; max-width: 100%; max-height: 240px; margin: 8px 0; border-radius: var(--radius-sm); }

.photo-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.preview img { display: block; max-width: 100%; max-height: 220px; margin-top: 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.needs-review input { border-color: var(--warn); box-shadow: 0 0 0 2px rgba(180, 83, 9, .3); }

img.zoomable { cursor: zoom-in; }
.ine-assist { border: 1px solid #d3def7; border-radius: var(--radius-md); padding: 4px 18px 14px; margin: 14px 0; background: var(--soft); }
.ine-text { white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; font-size: 1.05rem; }
button.suggested { outline: 3px solid var(--ok); outline-offset: 2px; }
#ext-status.ok { color: var(--ok); font-weight: 600; }
.warn { color: var(--bad); font-weight: 600; }

.viewer { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: rgba(10, 15, 40, .94); }
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; background: #fff; }
.viewer-bar .muted { flex: 1 1 200px; font-size: .85rem; }
.viewer-stage { flex: 1; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; }
.viewer-img { max-width: 100%; max-height: 100%; transform-origin: center center; user-select: none; -webkit-user-drag: none; }

/* Result of a query */

.result-banner { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-radius: var(--radius-md); border: 3px solid currentColor; margin: 14px 0; font-weight: 700; background: var(--card); }
.result-banner .result-icon { font-size: 3rem; line-height: 1; min-width: 3.5rem; text-align: center; }
.result-banner .result-label { font-size: 1.8rem; line-height: 1.15; }
.result-banner.pending { color: var(--warn); background: var(--warn-bg); }
.result-banner.valid { color: var(--ok); background: var(--ok-bg); }
.result-banner.not_valid, .result-banner.not_found { color: var(--bad); background: var(--bad-bg); }
.result-banner.mismatch { color: var(--warn); background: var(--warn-bg); }
.status-icon { height: 3.5rem; width: 3.5rem; object-fit: contain; }
.status-icon.small { height: 1.2em; width: 1.2em; vertical-align: -0.2em; margin-right: 4px; }
.evidence-thumb { max-width: 100%; max-height: 260px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: zoom-in; }
.icon-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 10px 0; }
.icon-row .icon-preview { margin: 0; padding: 6px 10px; min-width: 5rem; justify-content: center; }
.icon-row .icon-preview .result-icon { font-size: 2rem; min-width: 0; }

/* Small screens: the side bar becomes a top bar */

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .side { position: static; width: 100%; min-height: 0; max-height: none; }
  .brand { flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 0; }
  .brand img { width: 96px; }
  .tabs { flex-direction: row; flex: none; overflow-x: auto; padding: 0 8px 8px; }
  .tabs button { width: auto; white-space: nowrap; padding: 8px 14px; border-left: 0; border-bottom: 3px solid transparent; }
  .tabs button[aria-current="page"] { border-bottom-color: var(--primary-light); }
  .session { flex-direction: row; align-items: center; justify-content: space-between; padding: 8px 16px 12px; }
  main { padding: 16px 14px 36px; }
  .narrow { margin: 24px auto; }
}

/* Facial comparison: the percentage and its bar */

.big-percent { margin: 4px 0; font-size: 2.6rem; font-weight: 700; line-height: 1.1; color: var(--primary); }
progress.meter { display: block; width: 100%; height: 14px; border: 0; border-radius: 7px; overflow: hidden; background: var(--warn-bg); appearance: none; -webkit-appearance: none; }
progress.meter::-webkit-progress-bar { background: var(--warn-bg); }
progress.meter::-webkit-progress-value { background: var(--primary); }
progress.meter::-moz-progress-bar { background: var(--primary); }

/* "Please wait" popup */
.busy { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(11, 42, 74, 0.55); }
.busy-box { background: #fff; color: #1b2433; border-radius: 12px; padding: 28px 32px; max-width: 360px; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
.busy-box p { margin: 14px 0 0; font-weight: 600; }
.spinner { width: 42px; height: 42px; margin: 0 auto; border: 4px solid #d6def5; border-top-color: var(--primary, #1a3fc4); border-radius: 50%; animation: busy-spin 0.9s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Page title with the icon of each validation, and the home page */
.page-title { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.page-title img { flex: none; }
.card .page-title h2 { margin: 0; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 16px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  padding: 20px; background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm); cursor: pointer; font: inherit;
}
.tile:hover, .tile:focus-visible { border-color: var(--primary-light); box-shadow: 0 4px 14px rgba(26, 63, 196, .15); }
.tile-title { color: var(--primary); font-weight: 700; font-size: 1rem; }
.tile-text { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.grid .wide { grid-column: 1 / -1; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
td.ok { color: var(--ok); font-weight: 700; }
td.bad { color: var(--bad); font-weight: 700; }

.flow-editor { border: 1px solid var(--line, #d9dde3); border-radius: 8px; padding: 12px 16px; margin: 12px 0; }
.flow-editor h3 { margin-top: 0; }

.subtabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.flow-option { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; }

/* Run a flow: the flows as cards, and the screen of one flow */
.flow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.flow-tile {
  display: flex; flex-direction: column; align-items: stretch; gap: 14px; text-align: left; padding: 18px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); cursor: pointer; font: inherit;
}
.flow-tile:hover, .flow-tile:focus-visible { border-color: var(--primary-light); box-shadow: 0 4px 14px rgba(26, 63, 196, .15); }
.flow-name { color: var(--primary); font-weight: 700; font-size: 1.05rem; }
.flow-go { color: var(--primary); font-weight: 600; font-size: .88rem; margin-top: auto; }
.flow-icons { display: flex; flex-wrap: wrap; gap: 10px; }
.flow-icon { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 80px; text-align: center; font-size: .72rem; line-height: 1.25; color: var(--muted); }
.flow-icons.small { margin: 8px 0 18px; }
.flow-icons.small .flow-icon { flex-direction: row; width: auto; gap: 6px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); text-align: left; }
.eyebrow { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.flow-title { margin: 2px 0 0; }
.back-line { margin: 0 0 12px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; align-items: start; }
.file-slot label { margin-bottom: 6px; }
.file-preview img { display: block; max-width: 100%; max-height: 180px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.file-preview .file-name { margin: 0 0 14px; color: var(--ok); font-weight: 600; font-size: .88rem; }
.field-note { display: block; min-height: 1.3em; margin-top: 4px; font-weight: 600; font-size: .82rem; }
.field-note.ok { color: var(--ok); }
.field-note.bad { color: var(--bad); }

.doc-picture { margin: 0; }
.doc-picture img { width: 100%; max-height: 320px; object-fit: contain; border-radius: 8px; cursor: zoom-in; background: #f4f4f4; }
