/* DataMine Risk API portal: layout on top of datamine.css tokens */
body { background: var(--bg); }
.portal { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #D7DEEB; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; margin: 4px 8px 22px; }
.side .brand .word-mine { color: #5EEAD4; }
.side .sec { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: #8FA0BF; margin: 18px 10px 6px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #D7DEEB; font-weight: 500; font-size: .93rem; }
.side a.nav:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side a.nav.active { background: linear-gradient(135deg, rgba(14,165,160,.35), rgba(37,99,235,.35)); color: #fff; }
.side .who { margin: 26px 10px 0; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; color: #B5C1D6; }
.side .who b { color: #fff; display: block; }
.main { padding: 26px 34px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { font-size: 1.7rem; margin: 0; }
.topbar .sub { color: var(--muted); font-size: .95rem; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.card { padding: 20px 22px; }
.card h3 { font-size: 1.05rem; }
.kpi .n { font-family: var(--display); font-size: 1.9rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.kpi .t { color: var(--muted); font-size: .88rem; margin-top: 4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
table.tbl th { text-align: left; background: #F1F5FB; color: var(--ink-2); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl td { padding: 8px 10px; border-bottom: 1px solid #EEF2F8; vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: #FAFCFF; }
table.tbl.compact td, table.tbl.compact th { padding: 6px 8px; font-size: .84rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .83rem; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.g-0, .g-1, .g-2 { background: #DCFCE7; color: #166534; } .g-3, .g-4 { background: #E0F2FE; color: #075985; } .g-5, .g-6 { background: #FEF3C7; color: #92400E; } .g-7, .g-8, .g-9 { background: #FEE2E2; color: #991B1B; } .g-10 { background: #1F2937; color: #fff; }
.l-a, .l-b, .l-c, .l-d { background: #DCFCE7; color: #166534; } .l-e, .l-f, .l-g, .l-h { background: #E0F2FE; color: #075985; } .l-i, .l-j { background: #FEE2E2; color: #991B1B; } .l-x { background: #1F2937; color: #fff; }
.d-Approve { background: #DCFCE7; color: #166534; } .d-Reject { background: #FEE2E2; color: #991B1B; } .d-PTB { background: #FEF3C7; color: #92400E; }
form.f label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink-2); margin: 12px 0 5px; }
form.f input[type=text], form.f input[type=password], form.f input[type=number], form.f input[type=email], form.f select, form.f textarea { width: 100%; padding: 10px 12px; border: 1px solid #CBD5E1; border-radius: 9px; font: inherit; font-size: .93rem; background: #fff; }
form.f textarea { min-height: 160px; font-family: var(--mono); font-size: .82rem; }
form.f .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
form.f .help { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.btn-sm { padding: 8px 14px; font-size: .88rem; }
.btn-danger { background: #DC2626; color: #fff; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: .92rem; }
.alert-err { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-ok { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.alert-info { background: var(--blue-soft); color: #1E3A8A; border: 1px solid #BFDBFE; }
pre.json { background: #0B1630; color: #E2E8F0; padding: 14px 16px; border-radius: 10px; font-size: .8rem; line-height: 1.45; overflow: auto; max-height: 560px; margin: 0; }
pre.json .k { color: #7DD3FC; } pre.json .s { color: #BBF7D0; } pre.json .n { color: #FDE68A; } pre.json .b { color: #F9A8D4; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, #E6F7F6 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #EAF1FE 0%, transparent 60%), var(--bg); }
.login-card { width: 420px; max-width: 94vw; padding: 34px 36px; }
.flow { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.flow .step { flex: 1 1 150px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; position: relative; font-size: .86rem; }
.flow .step b { display: block; color: var(--ink); margin-bottom: 4px; }
.flow .step::after { content: "\2192"; position: absolute; right: -14px; top: 40%; color: var(--muted); font-size: 1.1rem; }
.flow .step:last-child::after { content: ""; }
.kb-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.kb-nav a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .86rem; color: var(--ink-2); }
.kb-nav a.active, .kb-nav a:hover { background: var(--brand-soft); border-color: #99E6E0; text-decoration: none; color: #0F766E; }
.prose { max-width: 980px; }
.prose h2 { font-size: 1.45rem; margin-top: 1.4em; } .prose h3 { font-size: 1.1rem; margin-top: 1.2em; }
.prose p, .prose li { font-size: .95rem; color: var(--text); }
.prose table { width: 100%; border-collapse: collapse; font-size: .86rem; margin: 10px 0 18px; }
.prose table th, .prose table td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.prose table th { background: #F1F5FB; }
.prose code { background: #F1F5FB; padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: .84em; }
.prose pre { background: #0B1630; color: #E2E8F0; padding: 14px; border-radius: 10px; overflow: auto; font-size: .82rem; }
.prose pre code { background: none; color: inherit; padding: 0; }
.bar { height: 10px; background: #EEF2F8; border-radius: 6px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--grad); }
.svgbox { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.sbs th.ours { background: #E6F7F6; } .sbs th.ce { background: #EAF1FE; }
.sbs td.same { color: #166534; } .sbs td.diff { color: #991B1B; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: .84rem; }
.hint { font-size: .82rem; color: var(--muted); }
@media (max-width: 980px) { .portal { grid-template-columns: 1fr; } .side { position: static; height: auto; } .g2, .g3, .g4 { grid-template-columns: 1fr; } .main { padding: 18px; } }

/* markdown documents rendered in the knowledge base */
.md table{border-collapse:collapse;font-size:12px;margin:8px 0;max-width:100%}.md th,.md td{border:1px solid #ddd;padding:3px 7px;vertical-align:top}.md th{background:#f4f6f8;text-align:left}.md pre,.md code{font-family:Consolas,Menlo,monospace;font-size:12px}.md pre{background:#f7f7f7;padding:8px;overflow:auto}.md h1{font-size:18px}.md h2{font-size:16px;margin-top:18px}.md h3{font-size:14px}

/* login page: features on the left, sign-in on the right (12 Oct 2026) */
.login-split { display: grid; grid-template-columns: 1.15fr 1fr; width: 960px; max-width: 96vw; min-height: 560px; border-radius: 22px; overflow: hidden; background: #fff; box-shadow: 0 24px 60px rgba(11, 22, 48, 0.18); }
.login-left { padding: 40px 42px; color: #fff; background: linear-gradient(160deg, #0B1630 0%, #10224A 55%, #0F766E 140%); display: flex; flex-direction: column; }
.login-left .brand { color: #fff; }
.login-left .brand .word-mine { color: #5EEAD4; }
.login-left h1 { font-size: 1.7rem; margin: 26px 0 8px; letter-spacing: -0.01em; }
.login-left .lead { color: #C7D2E5; font-size: 0.98rem; margin: 0 0 22px; max-width: 420px; }
.login-left .features { list-style: none; padding: 0; margin: 0; display: grid; gap: 13px; }
.login-left .features li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.login-left .features .ico { width: 24px; height: 24px; border-radius: 50%; background: rgba(94, 234, 212, 0.18); color: #5EEAD4; display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; margin-top: 1px; }
.login-left .features b { display: block; font-size: 0.95rem; color: #fff; }
.login-left .features span:not(.ico) { display: block; color: #AEBBD3; font-size: 0.86rem; line-height: 1.4; }
.login-right { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-right h2 { font-size: 1.4rem; margin: 0 0 4px; }
.login-right .f label { display: block; margin-top: 14px; font-weight: 600; }
.login-right .f input { width: 100%; }
@media (max-width: 860px) { .login-split { grid-template-columns: 1fr; min-height: 0; } .login-left { padding: 28px 24px; } .login-left .features { gap: 9px; } .login-left .features span:not(.ico) { display: none; } .login-right { padding: 28px 24px 34px; } }
.login-left h1, .login-left h1 * { color: #fff; }
.login-split, .login-split * { box-sizing: border-box; }
.login-wrap { padding: 16px; }
.login-right .f input { max-width: 100%; }
.login-split { width: 100%; max-width: 960px; }
.login-wrap { width: 100%; }
.login-wrap { box-sizing: border-box; }
.login-wrap { grid-template-columns: minmax(0, 1fr); }
.login-split { min-width: 0; justify-self: center; }

/* auth pages (sign in / forgot / reset): full-viewport split, no page scroll on desktop (12 Oct 2026) */
html.auth-html, body.auth-body { height: 100%; margin: 0; }
body.auth-body { overflow: hidden; background: #F3F6FB; }
.auth { display: grid; grid-template-columns: 1.1fr 1fr; height: 100vh; width: 100vw; overflow: hidden; }
.auth-left { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 52px; color: #fff; background: linear-gradient(160deg, #0B1630 0%, #10224A 55%, #0F766E 140%); }
.auth-left .brand { color: #fff; position: relative; z-index: 1; }
.auth-left .brand .word-mine { color: #5EEAD4; }
.auth-left .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; }
.auth-left .b1 { width: 420px; height: 420px; right: -120px; top: -140px; background: #2563EB; }
.auth-left .b2 { width: 360px; height: 360px; left: -120px; bottom: -160px; background: #0EA5A0; }
.auth-copy { position: relative; z-index: 1; max-width: 520px; }
.auth-copy h1 { color: #fff; font-size: clamp(1.6rem, 2.4vw, 2.2rem); margin: 0 0 8px; letter-spacing: -0.01em; }
.auth-copy .lead { color: #C7D2E5; font-size: 1rem; margin: 0 0 22px; }
.auth-copy .features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-copy .features li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.auth-copy .features .ico { width: 24px; height: 24px; border-radius: 50%; background: rgba(94, 234, 212, 0.18); color: #5EEAD4; display: grid; place-items: center; font-size: .85rem; font-weight: 700; margin-top: 1px; }
.auth-copy .features b { display: block; font-size: .95rem; color: #fff; }
.auth-copy .features span:not(.ico) { display: block; color: #AEBBD3; font-size: .85rem; line-height: 1.4; }
.auth-foot { position: relative; z-index: 1; color: #8FA0BF; font-size: .8rem; }
.auth-right { display: grid; place-items: center; overflow: auto; padding: 24px; background: radial-gradient(900px 500px at 100% 0%, #EAF1FE 0%, transparent 60%), #F7F9FC; }
.auth-panel { width: 100%; max-width: 400px; background: #fff; border: 1px solid #E5EAF2; border-radius: 18px; padding: 34px 32px; box-shadow: 0 18px 50px rgba(11, 22, 48, 0.08); }
.auth-panel h2 { font-size: 1.5rem; margin: 0 0 4px; }
.auth-panel .muted { margin: 0 0 16px; }
.auth-form label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
.auth-form .field-wrap { position: relative; }
.auth-form .field-wrap input { width: 100%; box-sizing: border-box; height: 46px; padding: 10px 44px 10px 14px; border: 1px solid #CBD5E1; border-radius: 12px; font: inherit; font-size: .95rem; background: #fff; transition: border-color .15s, box-shadow .15s; }
.auth-form .field-wrap input:focus { outline: none; border-color: #0EA5A0; box-shadow: 0 0 0 4px rgba(14, 165, 160, 0.15); }
.auth-form .eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; font-size: 1rem; color: #64748B; padding: 6px; border-radius: 8px; }
.auth-form .eye.on, .auth-form .eye:hover { color: #0F766E; background: #E6F7F6; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 18px; font-size: .88rem; }
.auth-row .check { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; color: var(--ink-2); }
.auth-row .check input { width: 16px; height: 16px; accent-color: #0F766E; }
.auth-row a { color: #0F766E; font-weight: 600; text-decoration: none; }
.auth-row a:hover { text-decoration: underline; }
.btn-wide { width: 100%; height: 46px; border-radius: 12px; font-size: 1rem; }
.auth-panel .hint { margin: 16px 0 0; }
.alert-ok { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin: 10px 0 14px; }
@media (max-width: 900px) { body.auth-body { overflow: auto; } .auth { grid-template-columns: 1fr; height: auto; min-height: 100vh; width: auto; overflow: visible; } .auth-left { padding: 28px 24px; } .auth-copy .features { gap: 8px; } .auth-copy .features span:not(.ico) { display: none; } .auth-foot { display: none; } .auth-right { padding: 20px 16px 32px; } }
@media (max-height: 700px) and (min-width: 901px) { .auth-left { padding: 26px 40px; } .auth-copy .features { gap: 8px; } .auth-copy .features span:not(.ico) { display: none; } .auth-copy .lead { margin-bottom: 14px; } }

/* ===== portal shell v2 (12 Oct 2026): compact sidebar, page help, denser cards ===== */
.portal { grid-template-columns: 232px 1fr; }
.sb { background: linear-gradient(180deg, #0B1630 0%, #0E1C3C 100%); color: #D7DEEB; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 16px 12px 12px; box-sizing: border-box; overflow: hidden; }
.sb-brand { color: #fff; margin: 2px 8px 14px; display: flex; align-items: center; gap: 10px; }
.sb-brand .word-mine { color: #5EEAD4; }
.sb-nav { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.sb-sec { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #7D8FB0; margin: 12px 10px 4px; }
.sb-link { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; color: #C9D3E6; font-weight: 500; font-size: .88rem; line-height: 1; text-decoration: none; margin: 1px 0; }
.sb-link svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .85; }
.sb-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sb-link.active { background: linear-gradient(135deg, rgba(14,165,160,.38), rgba(37,99,235,.38)); color: #fff; box-shadow: inset 0 0 0 1px rgba(94,234,212,.25); }
.sb-link.active svg { opacity: 1; }
.sb-user { margin-top: 10px; padding: 10px 10px 4px; border-top: 1px solid rgba(255,255,255,.1); display: grid; grid-template-columns: 32px 1fr; gap: 6px 10px; align-items: center; font-size: .8rem; }
.sb-user .avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #0EA5A0, #2563EB); color: #fff; display: grid; place-items: center; font-weight: 700; }
.sb-user-text { min-width: 0; line-height: 1.25; }
.sb-user-text b { color: #fff; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-text span { color: #9FB0CC; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.sb-user-links { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; }
.sb-user-links a, .sb-user-links button { color: #9ADBD6; background: none; border: 0; padding: 0; font: inherit; font-size: .8rem; cursor: pointer; text-decoration: none; }
.sb-user-links a:hover, .sb-user-links button:hover { text-decoration: underline; }
.main { padding: 20px 28px 48px; min-width: 0; }
.topbar { margin-bottom: 14px; }
.topbar h1 { font-size: 1.45rem; }
.topbar .sub { font-size: .9rem; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.sel-form select { padding: 8px 10px; border: 1px solid #CBD5E1; border-radius: 9px; background: #fff; font: inherit; font-size: .9rem; }
.pagehelp { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; background: #EEF6F6; border: 1px solid #CDEDEA; color: #0F4C49; border-radius: 10px; padding: 9px 12px; font-size: .86rem; line-height: 1.45; margin-bottom: 16px; }
.pagehelp svg { width: 18px; height: 18px; margin-top: 1px; color: #0F766E; }
.card { padding: 16px 18px; }
.card h3 { font-size: 1rem; margin-top: 0; }
.grid { gap: 14px; }
table.tbl { font-size: .86rem; }
table.tbl.compact th, table.tbl.compact td { padding: 6px 8px; }
table.kv th { width: 34%; color: var(--muted); font-weight: 500; text-align: left; }
.checks { display: grid; gap: 8px; margin-top: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 3px; accent-color: #0F766E; }
.check small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
form.f .row { gap: 10px 12px; }
form.f label { margin: 10px 0 4px; }
.client-card .cc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.client-card .cc-head h3 { margin: 0 0 2px; }
.client-card .cc-actions { display: flex; gap: 8px; margin-top: 12px; }
.client-card.new { border: 1px dashed #99E6E0; background: #F6FCFB; }
.glossary td:first-child { font-weight: 600; white-space: nowrap; }
.glossary td:last-child { white-space: nowrap; color: var(--muted); }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .portal { grid-template-columns: 1fr; } .sb { position: relative; height: auto; } .sb-nav { max-height: 240px; } .g2, .g3, .g4 { grid-template-columns: 1fr; } .main { padding: 16px; } }
/* no horizontal page scroll: wide tables scroll inside their card */
html, body.portal-body { overflow-x: hidden; }
.main { overflow-x: hidden; }
.card, .grid > * { min-width: 0; }
.card { overflow-x: auto; }
.topbar-right { flex-wrap: wrap; justify-content: flex-end; }
pre.json { overflow: auto; max-width: 100%; }
/* tables: never wrap cells; wide tables scroll inside their wrapper (portal.js wraps every table.tbl in .tbl-wrap) */
.tbl-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.tbl th, table.tbl td { white-space: nowrap; vertical-align: top; }
table.tbl td .small { white-space: nowrap; }
table.tbl td.wrap, table.tbl th.wrap { white-space: normal; }
.glossary td { white-space: normal; }
.glossary td:first-child, .glossary td:last-child { white-space: nowrap; }
form.f .row { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
/* fixed left menu (overflow-x hidden on body broke position: sticky); content gets a left margin instead of a grid column */
html, body.portal-body { overflow-x: clip; }
.portal { display: block; }
.sb { position: fixed; left: 0; top: 0; bottom: 0; width: 232px; height: 100vh; z-index: 20; }
.main { margin-left: 232px; min-height: 100vh; }
@media (max-width: 760px) { .sb { position: relative; width: auto; height: auto; bottom: auto; } .main { margin-left: 0; } }

/* ===== UI polish pass (12 Oct 2026): tables, filters, KPI cards, buttons, pagination ===== */
table.tbl { border-collapse: separate; border-spacing: 0; }
table.tbl th { position: sticky; top: 0; background: #F3F6FB; color: #334155; font-weight: 600; font-size: .78rem; letter-spacing: .02em; text-transform: uppercase; border-bottom: 1px solid #E2E8F0; z-index: 1; }
table.tbl.compact th, table.tbl.compact td { padding: 7px 10px; }
table.tbl tr:nth-child(even) td { background: #FAFBFD; }
table.tbl tr:hover td { background: #EEF6F6; }
table.tbl td { border-bottom: 1px solid #EEF2F7; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { border: 1px solid #E5EAF2; border-radius: 12px; background: #fff; }
.tbl-wrap table.tbl { border: 0; margin: 0; }
.card .tbl-wrap { border: 0; border-radius: 0; }
form.f.card, form.f .row { align-items: end; }
form.f label { font-size: .8rem; color: #475569; }
form.f input[type=text], form.f input[type=password], form.f input[type=number], form.f input[type=email], form.f select { height: 38px; padding: 6px 10px; border-radius: 9px; }
form.f select { background: #fff; }
.btn-sm { padding: 7px 14px; font-size: .86rem; border-radius: 9px; }
.kpi { position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(14,165,160,.14), transparent 70%); }
.kpi .n { font-size: 1.7rem; }
.kpi .t { font-size: .84rem; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.pill-ok { background: #DCFCE7; color: #166534; } .pill-amber { background: #FEF3C7; color: #92400E; } .pill-teal { background: #E6F7F6; color: #0F766E; }
.badge { min-width: 26px; text-align: center; }
p.small.muted { margin: 2px 0 8px; }
.main > p[style*="margin-top:12px"] { display: flex; gap: 8px; }
.alert { border-radius: 10px; padding: 10px 14px; font-size: .9rem; }
.alert-info { background: #EEF6F6; border: 1px solid #CDEDEA; color: #0F4C49; }
.alert-err { background: #FEE2E2; border: 1px solid #FECACA; color: #991B1B; }
.alert-ok { background: #DCFCE7; border: 1px solid #BBF7D0; color: #166534; }
.card h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card h3::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, #0EA5A0, #2563EB); }
pre.json { border-radius: 10px; }
.topbar-right .btn { white-space: nowrap; }

/* ===== collapsible sidebar (12 Oct 2026): body.sb-collapsed = icon rail; state kept in the ra_sb cookie so pages render collapsed without a flash ===== */
.sb, .main { transition: width .18s ease, margin-left .18s ease, padding .18s ease; }
.sb-toggle { display: flex; align-items: center; gap: 10px; height: 30px; margin: 0 0 6px; padding: 0 10px; border: 0; border-radius: 8px; background: rgba(255,255,255,.06); color: #AFC0DB; font: inherit; font-size: .78rem; cursor: pointer; }
.sb-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }
.sb-toggle svg { width: 16px; height: 16px; flex: 0 0 16px; }
.sb-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.sb-collapsed .sb { width: 64px; padding: 16px 8px 12px; }
body.sb-collapsed .main { margin-left: 64px; }
body.sb-collapsed .sb-brand { margin: 2px 0 12px; justify-content: center; }
body.sb-collapsed .sb-brand > span, body.sb-collapsed .sb-link span, body.sb-collapsed .sb-toggle span, body.sb-collapsed .sb-user-text, body.sb-collapsed .sb-user-links { display: none; }
body.sb-collapsed .sb-toggle { justify-content: center; padding: 0; }
body.sb-collapsed .sb-toggle svg { transform: scaleX(-1); }
body.sb-collapsed .sb-sec { height: 1px; margin: 8px 6px; padding: 0; font-size: 0; line-height: 0; background: rgba(255,255,255,.12); overflow: hidden; }
body.sb-collapsed .sb-link { justify-content: center; padding: 0; height: 38px; }
body.sb-collapsed .sb-link svg { width: 19px; height: 19px; flex-basis: 19px; }
body.sb-collapsed .sb-user { grid-template-columns: 1fr; justify-items: center; padding: 10px 0 4px; }
@media (max-width: 760px) { body.sb-collapsed .sb { width: auto; } body.sb-collapsed .main { margin-left: 0; } .sb-toggle { display: none; } }
.d-Refer { background: #E0E7FF; color: #3730A3; }

/* ===== shell v3 (12 Oct 2026 polish): denser type, brand-row toggle, fading nav, compact user block, rail tooltips ===== */
body.portal-body { font-size: 15px; line-height: 1.5; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* sidebar */
.sb { padding: 12px 10px 8px; background: linear-gradient(180deg, #0A1430 0%, #0D1B3D 55%, #0B1733 100%); box-shadow: inset -1px 0 0 rgba(94,234,212,.08); }
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 38px; margin: 0 0 8px; padding: 0 2px 0 6px; }
.sb-head .sb-brand { margin: 0; min-width: 0; font-size: 1.16rem; gap: 9px; white-space: nowrap; }
.sb-head .sb-brand .mark { width: 30px; height: 30px; }
.sb-toggle { flex: 0 0 30px; width: 30px; height: 30px; margin: 0; padding: 0; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.10); border-radius: 8px; background: rgba(255,255,255,.04); color: #9FB0CC; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.sb-toggle:hover, .sb-toggle:focus-visible { background: rgba(94,234,212,.12); border-color: rgba(94,234,212,.35); color: #fff; outline: none; }
.sb-toggle svg { width: 17px; height: 17px; flex: none; transition: transform .18s ease; }
.sb-nav { position: relative; padding: 0 2px 6px 0; margin-right: -4px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }
.sb-nav::-webkit-scrollbar { width: 6px; } .sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 6px; }
.sb-nav.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), transparent); }
.sb-nav.fade-t { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22px); mask-image: linear-gradient(to bottom, transparent, #000 22px); }
.sb-nav.fade-t.fade-b { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22px, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 22px, #000 calc(100% - 30px), transparent); }
.sb-sec { font-size: .63rem; font-weight: 600; letter-spacing: .16em; color: #6F82A6; margin: 12px 10px 3px; }
.sb-nav > .sb-sec:first-child { margin-top: 2px; }
.sb-link { position: relative; height: 32px; font-size: .855rem; gap: 11px; color: #C3CEE3; margin: 1px 0; transition: background .12s, color .12s; }
.sb-link.active { background: linear-gradient(100deg, rgba(14,165,160,.30), rgba(37,99,235,.22)); box-shadow: inset 0 0 0 1px rgba(94,234,212,.18); }
.sb-link.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #5EEAD4; box-shadow: 0 0 10px rgba(94,234,212,.7); }
.sb-link:focus-visible { outline: 2px solid rgba(94,234,212,.6); outline-offset: -2px; }
.sb-user { margin-top: 6px; padding: 9px 2px 2px 4px; display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px; gap: 4px 9px; align-items: center; }
.sb-user .avatar { width: 30px; height: 30px; font-size: .85rem; text-decoration: none; box-shadow: 0 0 0 2px rgba(94,234,212,.18); }
.sb-user a.avatar:hover { text-decoration: none; box-shadow: 0 0 0 2px rgba(94,234,212,.55); }
.sb-user-text b { font-size: .82rem; }
.sb-out { margin: 0; }
.sb-out button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #8FA3C4; cursor: pointer; padding: 0; }
.sb-out button:hover, .sb-out button:focus-visible { background: rgba(239,68,68,.16); color: #FCA5A5; outline: none; }
.sb-out svg { width: 17px; height: 17px; }
/* collapsed rail */
body.sb-collapsed .sb { padding: 12px 8px 8px; }
body.sb-collapsed .sb-head { flex-direction: column; height: auto; gap: 8px; padding: 0; margin-bottom: 6px; }
body.sb-collapsed .sb-head .sb-brand { justify-content: center; margin: 0; }
body.sb-collapsed .sb-toggle svg { transform: scaleX(-1); }
body.sb-collapsed .sb-nav { margin-right: -2px; padding-right: 0; }
body.sb-collapsed .sb-link { height: 34px; }
body.sb-collapsed .sb-nav > .sb-sec:first-child { display: none; }
body.sb-collapsed .sb-link.active::before { top: 9px; bottom: 9px; }
body.sb-collapsed .sb-user { grid-template-columns: 1fr; justify-items: center; gap: 6px; padding: 8px 0 2px; }
body.sb-collapsed .sb-user-text { display: none; }
.sb-tip { position: fixed; z-index: 100; left: 0; top: 0; transform: translateY(-50%); background: #0B1630; color: #E8EEF9; font-size: .8rem; font-weight: 500; line-height: 1.2; padding: 6px 10px; border-radius: 7px; border: 1px solid rgba(94,234,212,.28); box-shadow: 0 8px 24px rgba(11,22,48,.28); pointer-events: none; white-space: nowrap; opacity: 0; transition: opacity .1s; }
.sb-tip::before { content: ""; position: absolute; left: -5px; top: 50%; width: 8px; height: 8px; background: #0B1630; border-left: 1px solid rgba(94,234,212,.28); border-bottom: 1px solid rgba(94,234,212,.28); transform: translateY(-50%) rotate(45deg); }
.sb-tip.on { opacity: 1; }
/* main column: clip (not hidden) so position: sticky inside pages keeps working */
.main { overflow-x: clip; padding: 18px 26px 44px; }
.topbar { margin-bottom: 12px; align-items: flex-start; }
.topbar-title { min-width: 0; }
.topbar h1 { font-size: 1.38rem; line-height: 1.2; margin: 0; }
.topbar .sub { font-size: .86rem; margin-top: 2px; }
.topbar-right { padding-top: 2px; }
.pagehelp { grid-template-columns: 16px 1fr; gap: 9px; font-size: .83rem; line-height: 1.45; padding: 8px 12px 8px 11px; margin-bottom: 14px; background: linear-gradient(90deg, #EAF6F5, #F1F6FD); border: 1px solid #D5ECEA; border-left: 3px solid #0EA5A0; color: #134E4A; }
.pagehelp svg { width: 16px; height: 16px; margin-top: 2px; }
/* type inside cards: datamine.css sized .card p for the marketing site */
.card p { font-size: .9rem; }
.small, .card .small, .card p.small, p.small { font-size: .8rem; }
.card h3 { font-size: .98rem; }
/* key / value tables: labels in normal case, values wrap instead of being clipped */
table.tbl.kv th { text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 500; color: var(--muted); background: #F8FAFD; position: static; }
table.tbl.kv td { white-space: normal; overflow-wrap: anywhere; }
/* row-header tables (<tr><th>label</th><td>value</td>...): same treatment as .kv */
table.tbl tr > th:first-child:has(+ td) { text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 500; color: var(--muted); background: #F8FAFD; position: static; }
table.tbl th + td { white-space: normal; overflow-wrap: anywhere; }
/* inputs: dates and searches share the text-input look */
form.f input[type=date], form.f input[type=search] { width: 100%; height: 38px; padding: 6px 10px; border: 1px solid #CBD5E1; border-radius: 9px; font: inherit; font-size: .9rem; background: #fff; box-sizing: border-box; }
form.f input:focus, form.f select:focus, form.f textarea:focus { outline: none; border-color: #0EA5A0; box-shadow: 0 0 0 3px rgba(14,165,160,.14); }
/* tables that fill the viewport: header stays visible while the rows scroll inside the card */
.tbl-wrap:has(> table.tall) { max-height: max(320px, calc(100vh - 210px)); overflow: auto; }
tr[data-href] { cursor: pointer; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: .84rem; color: var(--muted); }
.pager .btns { display: flex; gap: 8px; }
.d-Proceed, .d-PTB { background: #FEF3C7; color: #92400E; }
.d-error { background: #FEE2E2; color: #991B1B; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h3 { margin: 0; }
.card-head .meta { font-size: .8rem; color: var(--muted); }
/* stacked share bar + legend */
.stackbar { display: flex; height: 12px; border-radius: 7px; overflow: hidden; background: #EEF2F8; margin: 6px 0 8px; }
.stackbar > i { display: block; height: 100%; min-width: 2px; }
.stackbar > i + i { box-shadow: -1px 0 0 #fff; }
.sw-Approve { background: #22C55E; } .sw-PTB { background: #F59E0B; } .sw-Refer { background: #6366F1; } .sw-Reject { background: #EF4444; } .sw-other { background: #94A3B8; }
/* column chart (CSS only) */
.colchart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; height: 132px; align-items: end; border-bottom: 1px solid #E2E8F0; padding: 0 2px; }
.colchart .c { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.colchart .c .v { font-size: .7rem; color: #475569; font-variant-numeric: tabular-nums; margin-bottom: 3px; white-space: nowrap; }
.colchart .c i { display: block; width: 100%; max-width: 30px; min-height: 2px; border-radius: 5px 5px 1px 1px; background: linear-gradient(180deg, #2DD4BF, #0EA5A0); }
.colchart .c.zero .v { color: #CBD5E1; }
.colchart .c.zero i { background: #E2E8F0; }
.colchart .c i.k-ok { background: linear-gradient(180deg, #4ADE80, #16A34A); } .colchart .c i.k-mid { background: linear-gradient(180deg, #38BDF8, #0284C7); }
.colchart .c i.k-warn { background: linear-gradient(180deg, #FBBF24, #D97706); } .colchart .c i.k-bad { background: linear-gradient(180deg, #F87171, #DC2626); } .colchart .c i.k-dark { background: linear-gradient(180deg, #64748B, #1F2937); }
.colchart-x { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; justify-items: center; margin-top: 6px; padding: 0 2px; }
.colchart-x .badge { min-width: 0; padding: 1px 6px; font-size: .72rem; }
.chart-note { font-size: .78rem; color: var(--muted); margin: 8px 0 0; line-height: 1.4; }
/* inline share bar in table cells */
.mbar { display: inline-block; vertical-align: middle; width: 90px; height: 7px; border-radius: 4px; background: #EEF2F8; overflow: hidden; margin-right: 8px; }
.mbar > i { display: block; height: 100%; background: linear-gradient(90deg, #0EA5A0, #2563EB); border-radius: 4px; }
@media (max-width: 760px) { .sb-head { height: auto; } .sb-user { grid-template-columns: 30px 1fr 30px; } }
/* glossary tables (policy settings explained): the explanation column wraps; table.tbl's nowrap rule outranked .glossary td */
table.tbl.glossary td { white-space: normal; }
table.tbl.glossary td:first-child { white-space: nowrap; }
table.tbl.glossary td:last-child { white-space: normal; overflow-wrap: anywhere; min-width: 150px; color: var(--muted); }

/* compare switch (15 Oct 2026): body.cmp-off hides every comparison with the Alt Partner; .cmp-offonly shows only while it is off */
body.cmp-off .cmp { display: none !important; }
body:not(.cmp-off) .cmp-offonly { display: none !important; }
.cmp-switch { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--ink-2); cursor: pointer; user-select: none; white-space: nowrap; position: relative; }
.cmp-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cmp-switch .tr { width: 36px; height: 20px; border-radius: 10px; background: #CBD5E1; position: relative; transition: background .15s; flex: none; }
.cmp-switch .tr::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.3); transition: left .15s; }
.cmp-switch input:checked + .tr { background: var(--brand); }
.cmp-switch input:checked + .tr::after { left: 18px; }
.cmp-switch input:focus-visible + .tr { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* ===== overlap fixes 17 Oct 2026 (owner report: text running over the next cell / box) =====
   Each rule names one page's own class (or one component); the body.portal-body prefix lifts it above the page's inline <style>.
   Bank review and WhatsApp fixes live in templates/bankreview/_style.html and templates/wa/_style.html (br- / wa- prefixes). */
/* any table: buttons in a cell keep one line (an inline-flex .btn with white-space normal reported a two-line min-content, so a squeezed
   table gave the cell less room than the buttons take - users and WA triggers on a phone) */
body.portal-body table.tbl td .btn { white-space: nowrap; }
/* card headings that end in a long code wrap instead of running out of the card (rule engine policy name on a phone) */
body.portal-body .card h3 { flex-wrap: wrap; }
body.portal-body .card h3 > * { min-width: 0; overflow-wrap: anywhere; }
/* request detail: a long rule code under the decision KPI breaks inside its card */
body.portal-body .card.kpi .t { overflow-wrap: anywhere; }
/* phone: the page title takes the whole row; the top-right controls go under it */
@media (max-width: 760px) {
  body.portal-body .topbar { flex-wrap: wrap; }
  body.portal-body .topbar-title { flex: 1 1 100%; }
  body.portal-body .topbar-title h1, body.portal-body .topbar-title .sub { overflow-wrap: anywhere; }
}
/* dashboard: decision reasons - the count column is as wide as its number (122,695 ran past the tile) */
body.portal-body .dt-reasons li { grid-template-columns: minmax(0, 1fr) 56px max-content; }
/* dashboard: grade / letter column charts - in a narrow card the counts stand vertically so neighbours never collide */
body.portal-body .colchart { container-type: inline-size; }
@container (max-width: 470px) {
  .colchart .c { padding-top: 28px; }
  .colchart .c .v { writing-mode: vertical-rl; transform: rotate(180deg); line-height: 1; font-size: .66rem; margin-bottom: 4px; }
}
/* request log / decision viewer filters: the button pair wraps inside its grid cell */
body.portal-body form.f.filterbar .acts, body.portal-body form.f.dv-filter .go { flex-wrap: wrap; }
/* client documentation: the two-column examples never grow past their column */
body.portal-body .docbody .two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
body.portal-body .docbody .two > * { min-width: 0; }
@media (max-width: 900px) { body.portal-body .docwrap, body.portal-body .docbody .two { grid-template-columns: minmax(0, 1fr); } }
/* client sandbox console: the scenario select (margin-left 8px) stays inside its column */
body.portal-body .sbx-console select { width: calc(100% - 8px); }
/* rule engine: decision badges in the fixed-layout tables may wrap; the rule list stacks on a phone */
body.portal-body table.tbl.fit .badge, body.portal-body table.tbl.fit .pill { white-space: normal; max-width: 100%; }
body.portal-body .rl-row > * { min-width: 0; }
body.portal-body .kv-chip { max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  body.portal-body .rl-head { display: none; }
  body.portal-body .rl-row { grid-template-columns: 30px minmax(0, 1fr); gap: 6px 10px; }
  body.portal-body .rl-row > :nth-child(n+3) { grid-column: 2; }
  body.portal-body table.tbl.fit { min-width: 560px; }
}
/* external connections: fixed-layout tables keep a readable width on a phone and scroll in their wrapper */
body.portal-body table.tbl.cx-fix th { white-space: normal; overflow-wrap: anywhere; }
body.portal-body table.tbl.cx-fix .pill, body.portal-body table.tbl.cx-list .cx-st { white-space: normal; }
body.portal-body .cx-two { grid-template-columns: repeat(auto-fit, minmax(min(540px, 100%), 1fr)); }
@media (max-width: 760px) {
  body.portal-body table.tbl.cx-list { min-width: 980px; }
  body.portal-body table.tbl.cx-fix { min-width: 560px; }
  body.portal-body .cx-g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* decision viewer: KPI and fact grids go to two columns on a phone; the case layout never grows past the page */
body.portal-body .dv-layout > * { min-width: 0; }
@media (max-width: 980px) { body.portal-body .dv-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { body.portal-body .dv-kpis, body.portal-body .dv-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* endpoint detail: long model names break inside the stat */
body.portal-body .ep-stat .v.models > * { overflow-wrap: anywhere; }
/* workflows: decision chips in the fixed-layout tables may wrap; section heads wrap their hint */
body.portal-body table.tbl.wf-fx td .dec { white-space: normal; max-width: 100%; }
body.portal-body .wf-head > * { min-width: 0; overflow-wrap: anywhere; }
/* client documentation: long codes / URLs in the field tables and mono notes break instead of widening the page */
body.portal-body .docbody table.dt td, body.portal-body .docbody table.dt th, body.portal-body .docbody .mono { overflow-wrap: anywhere; }
/* rule engine: condition expressions stay inside their column (the inline padding ran past the edge) */
body.portal-body .rl-row code.expr { display: inline-block; max-width: 100%; overflow-wrap: anywhere; vertical-align: top; }
/* decision viewer case page: rule codes, notes and alerts break inside their panel; the policy table scrolls on a phone */
body.portal-body .dv-verdict > *, body.portal-body .dv-verdict .codes code, body.portal-body .dv-two > div, body.portal-body .dv-panel .alert { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  body.portal-body .dv-two { grid-template-columns: minmax(0, 1fr); }
  body.portal-body table.tbl.dv-pol { min-width: 560px; }
}

/* ===== fit pass (23 Oct 2026): wide screens felt oversized at 100% zoom (owner: "100% a bit odd, fits at 80%").
   A gentle root-size step scales the rem-based chrome (headings, sidebar, KPI numbers) down on large screens so the
   default zoom reads like the owner's 80%; body copy (15px) and px spacing are untouched, so nothing reflows or breaks.
   KPI cards get denser, and .g4 gains a 3-up tier so 1040-1360px screens stop jumping straight from 4-up to 2-up.
   :has() scopes the root step to portal pages only (auth/marketing use their own body class); it no-ops on old engines. */
@media (min-width: 1500px) { html:has(body.portal-body) { font-size: 15px; } }
@media (min-width: 1850px) { html:has(body.portal-body) { font-size: 14.5px; } }
.kpi .n { font-size: clamp(1.3rem, 0.95rem + 0.8vw, 1.6rem); }
.card.kpi { padding: 13px 16px; }
.kpi .t { font-size: .82rem; }
@media (max-width: 1360px) { .g4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1040px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px)  { .g4 { grid-template-columns: 1fr; } }
