/* KYC Onboarding — classification + table extraction + auth */
:root {
  --bg: #eef4f2;
  --bg2: #e2ebe8;
  --panel: #ffffff;
  --panel2: #f4f9f7;
  --ink: #123332;
  --dim: #5f7a78;
  --line: #d5e3e0;
  --teal: #0d9488;
  --teal2: #14b8a6;
  --amber: #b45309;
  --amber-bg: #fff7ed;
  --red: #b91c1c;
  --red-bg: #fef2f2;
  --green: #047857;
  --green-bg: #ecfdf5;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --shadow: 0 10px 28px rgba(18, 51, 50, 0.07);
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(1000px 420px at 0% -10%, rgba(20,184,166,.12), transparent 55%),
              linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--ink);
  font: 15px/1.55 var(--sans);
}

.authgate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.authcard {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 26px;
  box-shadow: var(--shadow);
}
.authbrand { text-align: center; margin-bottom: 18px; }
.authbrand .logo { margin: 0 auto 10px; }
.authbrand h1 { font-family: var(--serif); font-size: 24px; }
.authform { display: flex; flex-direction: column; gap: 12px; }
.authform label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--dim); }
.authform input {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
  font: 15px var(--sans); color: var(--ink); outline: none;
}
.authform input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,148,136,.12); }
.authactions { display: flex; gap: 10px; margin-top: 4px; }
.authactions button {
  flex: 1; border: 0; border-radius: 10px; padding: 11px 14px; font-weight: 700;
  cursor: pointer; font-family: inherit; background: linear-gradient(145deg, var(--teal2), var(--teal)); color: #fff;
}
.authactions .ghost { background: none; border: 1px solid var(--line); color: var(--dim); }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; height: 100vh; }
.nav {
  background: #0f2928; color: #d7e6e4; padding: 20px 14px 14px;
  display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.logo {
  width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(145deg, var(--teal2), var(--teal));
  display: grid; place-items: center; color: white; font-size: 18px; font-weight: 900;
}
.brand h1 { font-family: var(--serif); font-size: 16px; line-height: 1.2; color: #fff; }
.brand p { color: #8fb5b1; font-size: 11px; margin-top: 2px; }
nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.navlink { color: #9dc0bc; text-decoration: none; padding: 10px 12px; border-radius: 8px; font-weight: 650; font-size: 13.5px; }
.navlink:hover { background: rgba(255,255,255,.07); color: #fff; }
.navlink.active { background: rgba(15,181,166,.22); color: #7ff0e5; }
.navfoot { display: flex; flex-direction: column; gap: 8px; }
.badge {
  font-size: 11px; background: rgba(255,255,255,.08); padding: 4px 8px; border-radius: 99px;
  color: #7ff0e5; width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.muted { color: var(--dim); font-size: 12.5px; }
.navfoot .muted { color: #8fb5b1; }
.authuser { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.ghost {
  background: none; border: 1px solid var(--line); color: var(--dim); padding: 7px 14px;
  border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px;
}
.ghost:hover { color: var(--teal); border-color: var(--teal); }
.ghost.sm { padding: 4px 9px; font-size: 11.5px; }
.nav .ghost { border-color: rgba(255,255,255,.18); color: #9dc0bc; }

.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.72); backdrop-filter: blur(8px);
}
main { flex: 1; min-height: 0; overflow: auto; padding: 22px 28px 28px; }
.page { display: none; }
.page.active { display: block; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.pagehead h2 { font-family: var(--serif); font-size: 26px; font-weight: 650; }
.pagehead .muted { margin-top: 4px; }

.drop {
  border: 2px dashed var(--line); border-radius: 16px; background: var(--panel);
  transition: border-color .15s, background .15s; box-shadow: var(--shadow);
}
.drop.over { border-color: var(--teal2); background: #ecfdf9; }
.dropinner { text-align: center; padding: 42px 20px; }
.drop .big { font-size: 36px; color: var(--teal2); }
.drop h3 { font-family: var(--serif); margin: 6px 0 4px; }
.btn {
  background: linear-gradient(145deg, var(--teal2), var(--teal)); color: white; border: 0;
  border-radius: 10px; padding: 12px 24px; font-weight: 700; cursor: pointer; font-size: 14px; font-family: inherit;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost2 { background: none; border: 1px solid var(--line); color: var(--dim); }
.btn.ghost2:hover { color: var(--teal); border-color: var(--teal); }
.cachebar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px;
}
.filelist { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.filepill.cached { border-color: rgba(13,148,136,.4); background: rgba(13,148,136,.08); }
.skipnote {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--panel2);
  border: 1px solid var(--line); font-size: 13px; color: var(--dim);
}
.filepill {
  background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px;
  font-size: 13px; display: flex; gap: 8px; align-items: center;
}
.filepill button { border: 0; background: none; color: var(--red); cursor: pointer; font-weight: 700; }
.runrow { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.progresswrap { margin-top: 22px; }
.progresstrack { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progressbar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--teal2), var(--teal)); transition: width .4s; }

.kycbar {
  border-radius: 14px; padding: 16px 20px; margin-bottom: 18px; background: var(--panel);
  border: 1px solid var(--line); display: flex; gap: 24px; flex-wrap: wrap; align-items: center; box-shadow: var(--shadow);
}
.kycbar .st { font-weight: 800; font-size: 13px; padding: 6px 14px; border-radius: 99px; letter-spacing: .02em; }
.st.clean { background: var(--green-bg); color: var(--green); }
.st.review { background: var(--amber-bg); color: var(--amber); }
.kycbar b { display: block; font-size: 16px; }
.kycbar span { color: var(--dim); font-size: 12px; }

.sectioncard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow);
}
.sectioncard > header {
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel2);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.sectioncard > header h3 { font-family: var(--serif); font-weight: 650; font-size: 17px; }
.sectioncard .body { padding: 0; }

table.data {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
}
table.data th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--dim); background: #f8fbfa; padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top;
  word-break: break-word;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: rgba(13,148,136,.03); }
table.data .fname { font-weight: 650; color: var(--ink); white-space: nowrap; }
table.data .fval { font-weight: 600; }
table.data .fev { color: var(--dim); font-size: 12px; font-style: italic; max-width: 280px; }
table.data .raw { color: var(--dim); font-size: 11.5px; }

.typepill {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(13,148,136,.1);
  color: var(--teal); border: 1px solid rgba(13,148,136,.25); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 700;
}
.typepill.warn { background: var(--amber-bg); color: var(--amber); border-color: rgba(180,83,9,.25); }
.typepill.err { background: var(--red-bg); color: var(--red); border-color: rgba(185,28,28,.25); }
.hw { font-size: 11px; color: var(--dim); font-weight: 650; }

.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 700; }
.pill.hi { background: var(--green-bg); color: var(--green); }
.pill.mid { background: var(--amber-bg); color: var(--amber); }
.pill.lo { background: var(--red-bg); color: var(--red); }
.statusok { color: var(--green); font-weight: 700; font-size: 12px; }
.statusflag { color: var(--amber); font-weight: 700; font-size: 12px; }
.statusmiss { color: var(--red); font-weight: 700; font-size: 12px; }

.flagbox {
  border-left: 4px solid #f59e0b; background: #fffbeb; border-radius: 0 10px 10px 0;
  padding: 10px 14px; margin: 12px 16px 14px; font-size: 13.5px;
}
.repblock {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 22px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.repblock h3 { font-family: var(--serif); font-weight: 650; margin-bottom: 8px; }
.check { display: flex; gap: 8px; padding: 5px 0; font-size: 13.5px; }
.ok { color: var(--green); font-weight: 700; }
.miss { color: var(--dim); }
.about {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; box-shadow: var(--shadow); max-width: 720px;
}
.empty {
  border: 1px dashed var(--line); border-radius: 14px; padding: 28px; text-align: center; color: var(--dim);
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .nav { height: auto; }
  .workspace { height: auto; min-height: 70vh; }
  table.data .fev { max-width: 160px; }
}
