:root {
  --navy: #123e59;
  --blue: #1f6687;
  --blue-2: #2e84aa;
  --sky: #e8f3f8;
  --ice: #f5f9fb;
  --white: #ffffff;
  --ink: #183247;
  --muted: #657b8b;
  --line: #d7e4eb;
  --green: #188568;
  --green-bg: #e7f6f0;
  --amber: #a96b18;
  --amber-bg: #fff4df;
  --red: #a74444;
  --red-bg: #fbeaea;
  --shadow: 0 18px 55px rgba(18, 62, 89, .11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: #f3f7f9;
  font-family: Inter, "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

.demo-ribbon {
  padding: .45rem 1rem;
  color: #d9edf5;
  background: var(--navy);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}
.topbar {
  height: 76px;
  padding: 0 max(1.2rem, calc((100vw - 1220px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .8rem; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; color: white; background: linear-gradient(145deg, var(--navy), var(--blue-2));
  font-weight: 800;
}
.brand strong, .brand small, .profile strong, .profile small { display: block; }
.brand strong { font-size: 1.03rem; }
.brand small, .profile small { color: var(--muted); font-size: .72rem; }
.top-actions { display: flex; align-items: center; gap: .9rem; }
.mode-badge, .security-pill, .success-pill {
  padding: .42rem .7rem;
  border-radius: 999px;
  color: var(--blue);
  background: var(--sky);
  font-size: .72rem;
  font-weight: 800;
}
.mode-badge.live { color: var(--green); background: var(--green-bg); }
.icon-button {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%;
  color: var(--blue); background: white; font-weight: 800;
}
.profile { display: flex; align-items: center; gap: .55rem; }
.profile > span {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; color: white; background: var(--blue); font-size: .78rem; font-weight: 800;
}

main { width: min(1220px, calc(100% - 2rem)); margin: 0 auto 5rem; }
.hero > *, .section-heading > *, .step > div, .connect-grid > *, .review-layout > *, .approval-grid > * {
  min-width: 0;
}
.hero {
  margin: 1.8rem 0 1rem;
  padding: clamp(1.8rem, 4vw, 3.2rem);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  color: white;
  background:
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.16), transparent 28%),
    linear-gradient(130deg, var(--navy), var(--blue));
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 .45rem; color: var(--blue-2); font-size: .72rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.hero .eyebrow { color: #a9dbef; }
.hero h1 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(2.3rem, 5vw, 4.35rem);
  line-height: .98;
  letter-spacing: -.055em;
}
.hero p:not(.eyebrow) { max-width: 720px; margin: 1rem 0 0; color: #d9edf5; font-size: 1.05rem; }
.hero-stat {
  min-width: 245px; padding: 1.1rem 1.2rem; border: 1px solid rgba(255,255,255,.25);
  border-radius: 18px; background: rgba(255,255,255,.1); backdrop-filter: blur(10px);
}
.hero-stat span, .hero-stat strong, .hero-stat small { display: block; }
.hero-stat span, .hero-stat small { color: #c8e4ef; font-size: .74rem; }
.hero-stat strong { margin: .35rem 0; }

.steps {
  margin: 1rem 0;
  padding: .75rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .6rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.step {
  padding: .75rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  border: 0;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}
.step > span {
  width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; color: var(--muted); background: #eaf0f3; font-weight: 800;
}
.step strong, .step small { display: block; }
.step div { font-size: .83rem; font-weight: 800; }
.step small { font-size: .68rem; font-weight: 500; }
.step.active { color: var(--blue); background: var(--sky); }
.step.active > span, .step.complete > span { color: white; background: var(--blue); }
.step.complete { color: var(--ink); }

.workspace {
  padding: clamp(1.2rem, 3vw, 2rem);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.hidden { display: none !important; }
.section-heading {
  margin-bottom: 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.section-heading h2, .analysis-loader h2, .success-state h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.25rem); letter-spacing: -.03em; }
.connect-grid, .approval-grid, .review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, .75fr);
  gap: 1.2rem;
}
.bank-list { display: grid; gap: .75rem; }
.bank-card {
  width: 100%; padding: 1rem;
  display: flex; align-items: center; gap: .9rem;
  border: 1px solid var(--line); border-radius: 16px;
  color: var(--ink); background: var(--white); text-align: left;
}
.bank-card:hover, .bank-card.selected { border-color: var(--blue-2); background: var(--ice); box-shadow: 0 0 0 3px rgba(46,132,170,.08); }
.bank-card div { flex: 1; }
.bank-card strong, .bank-card small { display: block; }
.bank-card small { margin-top: .2rem; color: var(--muted); }
.bank-icon {
  width: 43px; height: 43px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 12px; color: white; font-size: .75rem; font-weight: 900;
}
.bank-a { background: #1f6687; } .bank-b { background: #735c99; } .bank-c { background: #a96b18; }
.radio { width: 19px; height: 19px; border: 2px solid #9db0bc; border-radius: 50%; }
.bank-card.selected .radio { border: 6px solid var(--blue); }
.consent-card, .approval-consent, .integration-aside {
  padding: 1.25rem; border-radius: 18px; background: var(--ice); border: 1px solid var(--line);
}
.consent-card h3, .approval-consent h3, .integration-aside h3 { margin: .65rem 0; }
.consent-card ul { padding-left: 1.2rem; color: var(--muted); font-size: .86rem; }
.consent-card li { margin: .5rem 0; }
.card-icon, .shield {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; color: white; background: var(--blue); font-size: 1.2rem; font-weight: 900;
}
.check-row { margin: 1rem 0; display: flex; align-items: flex-start; gap: .65rem; color: var(--ink); font-size: .84rem; }
.check-row input { width: 18px; height: 18px; margin: .08rem 0 0; accent-color: var(--blue); }
.primary-button, .secondary-button, .text-button {
  min-height: 44px; padding: .72rem 1rem; border-radius: 12px; font-weight: 800;
}
.primary-button { border: 1px solid var(--blue); color: white; background: var(--blue); }
.primary-button:hover:not(:disabled) { background: var(--navy); }
.secondary-button { border: 1px solid var(--line); color: var(--blue); background: white; }
.text-button { width: 100%; margin-top: .35rem; border: 0; color: var(--blue); background: transparent; font-size: .8rem; }
.consent-card .primary-button, .approval-consent .primary-button { width: 100%; }
.fallback-box {
  margin-top: 1rem; padding: 1rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border: 1px dashed var(--amber); border-radius: 16px; background: var(--amber-bg);
}
.fallback-box p { margin: .25rem 0 0; color: var(--muted); }
.file-types { display: flex; gap: .4rem; }
.file-types span { padding: .4rem .55rem; border-radius: 8px; color: var(--amber); background: white; font-size: .7rem; font-weight: 900; }
.notice { margin: 1rem 0; padding: .85rem 1rem; border-radius: 13px; color: var(--blue); background: var(--sky); border: 1px solid #c9e4ef; }
.notice.warning { color: var(--amber); background: var(--amber-bg); border-color: #efd7aa; }

.account-strip {
  margin-bottom: 1.2rem; padding: 1rem;
  display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 1rem;
  border-radius: 16px; background: var(--ice); border: 1px solid var(--line);
}
.account-strip > div:first-child { display: flex; align-items: center; gap: .7rem; }
.account-strip small, .account-strip strong { display: block; }
.account-strip small { color: var(--muted); font-size: .72rem; }
.integration-flow {
  margin-bottom: 1.2rem; display: grid; grid-template-columns: 1fr 30px 1fr 30px 1fr 30px 1fr; align-items: center; gap: .35rem;
}
.integration-flow i { color: var(--blue-2); font-style: normal; font-size: 1.3rem; text-align: center; }
.integration-node {
  padding: .8rem; border-radius: 14px; background: var(--ice); border: 1px solid var(--line);
}
.integration-node span { float: right; color: var(--blue); font-size: .7rem; font-weight: 900; }
.integration-node strong, .integration-node small { display: block; }
.integration-node small { color: var(--muted); font-size: .7rem; }
.integration-node.done { border-color: #a9dcca; background: var(--green-bg); }
.integration-node.ai { border-color: #b8dbea; background: var(--sky); }
.table-card, .approval-list-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; }
.table-title { padding: .85rem 1rem; display: flex; align-items: center; justify-content: space-between; background: var(--ice); }
.table-title strong, .table-title small { display: block; }
.table-title small { color: var(--muted); font-size: .72rem; }
.table-title > span { color: var(--blue); font-size: .75rem; font-weight: 800; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th { padding: .7rem 1rem; color: var(--muted); background: white; border-bottom: 1px solid var(--line); font-size: .68rem; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
td.amount { text-align: right; font-variant-numeric: tabular-nums; }
.action-row { margin-top: 1.2rem; display: flex; justify-content: space-between; gap: .7rem; }

.analysis-loader { min-height: 480px; display: grid; place-items: center; align-content: center; text-align: center; }
.pulse-logo {
  width: 68px; height: 68px; display: grid; place-items: center;
  border-radius: 20px; color: white; background: linear-gradient(145deg, var(--navy), var(--blue-2));
  font-size: 1.8rem; font-weight: 900; animation: pulse 1.4s infinite;
}
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 14px rgba(46,132,170,.08); } }
.analysis-loader p:not(.eyebrow) { color: var(--muted); }
.loader-track { width: min(520px, 90%); height: 8px; overflow: hidden; border-radius: 99px; background: #e4edf2; }
.loader-track span { display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--blue-2); animation: load 1.6s infinite ease-in-out; }
@keyframes load { from { transform: translateX(-110%); } to { transform: translateX(330%); } }
.processing-steps { margin-top: 1.2rem; display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; }
.processing-steps span { padding: .35rem .55rem; border-radius: 99px; color: var(--muted); background: var(--ice); font-size: .7rem; }
.processing-steps span.active { color: var(--blue); background: var(--sky); }

.analysis-meta { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .75rem; }
.analysis-meta span { padding: .35rem .55rem; border-radius: 99px; background: var(--ice); border: 1px solid var(--line); }
.review-summary { margin-bottom: 1.2rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
.review-summary > div { padding: .85rem 1rem; border-top: 3px solid var(--blue); background: var(--ice); }
.review-summary strong, .review-summary small { display: block; }
.review-summary strong { color: var(--blue); font-size: 1.45rem; }
.review-summary small { color: var(--muted); font-size: .7rem; }
.filter-row { margin-bottom: .75rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.filter { padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: white; font-size: .72rem; font-weight: 800; }
.filter.active { color: white; background: var(--blue); border-color: var(--blue); }
.partner-list { display: grid; gap: .65rem; }
.partner-card { padding: .9rem; border: 1px solid var(--line); border-radius: 15px; background: white; }
.partner-card.excluded { opacity: .62; background: #f8fafb; }
.partner-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .75rem; }
.partner-check { width: 19px; height: 19px; accent-color: var(--blue); }
.partner-name { min-width: 0; }
.partner-name strong, .partner-name small { display: block; }
.partner-name small { overflow: hidden; color: var(--muted); font-size: .69rem; text-overflow: ellipsis; white-space: nowrap; }
.partner-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
.tag { padding: .3rem .48rem; border-radius: 99px; color: var(--blue); background: var(--sky); font-size: .65rem; font-weight: 800; }
.tag.critical { color: var(--red); background: var(--red-bg); }
.tag.uncertain { color: var(--amber); background: var(--amber-bg); }
.partner-details { margin: .7rem 0 0 2rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.partner-details div { padding: .55rem; border-radius: 9px; background: var(--ice); }
.partner-details small, .partner-details strong { display: block; }
.partner-details small { color: var(--muted); font-size: .62rem; text-transform: uppercase; }
.partner-details strong { font-size: .75rem; }
.reasoning { margin: .65rem 0 0 2rem; color: var(--muted); font-size: .75rem; }
.reasoning b { color: var(--blue); }
.edit-row { margin: .65rem 0 0 2rem; display: flex; gap: .45rem; }
.edit-row input { flex: 1; min-width: 0; padding: .48rem .6rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); }
.edit-row button { padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 9px; color: var(--blue); background: white; font-size: .7rem; font-weight: 800; }
.mini-flow { margin-top: 1rem; display: grid; gap: .35rem; }
.mini-flow > div { padding: .65rem; border-radius: 11px; background: white; border: 1px solid var(--line); }
.mini-flow > div.highlight { border-color: #9bcfe2; background: var(--sky); }
.mini-flow span { color: var(--blue); font-size: .66rem; font-weight: 900; text-transform: uppercase; }
.mini-flow p { margin: .15rem 0 0; font-size: .76rem; }
.mini-flow b { color: var(--blue-2); text-align: center; }
.aside-note { margin-top: 1rem; color: var(--muted); font-size: .74rem; }
.sticky-actions { position: sticky; bottom: .5rem; padding: .7rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); }

.approval-list { padding: .8rem 1rem; }
.approval-item { padding: .8rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .8rem; border-bottom: 1px solid var(--line); }
.approval-item:last-child { border-bottom: 0; }
.approval-item small { display: block; color: var(--muted); }
.approval-item span { color: var(--blue); font-weight: 800; }
.approval-consent p { color: var(--muted); font-size: .84rem; }
.success-state { padding: 2rem 1rem; text-align: center; }
.success-icon {
  width: 72px; height: 72px; margin: auto; display: grid; place-items: center;
  border-radius: 50%; color: white; background: var(--green); font-size: 2rem; font-weight: 900;
}
.success-state .eyebrow { margin-top: 1rem; }
.success-state p:not(.eyebrow) { max-width: 680px; margin: .8rem auto; color: var(--muted); }
.audit-card { margin: 0 auto 1.3rem; max-width: 920px; display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.audit-card div { padding: 1rem; background: var(--ice); border-right: 1px solid var(--line); }
.audit-card div:last-child { border-right: 0; }
.audit-card span, .audit-card strong { display: block; }
.audit-card span { color: var(--muted); font-size: .65rem; text-transform: uppercase; }
.audit-card strong { margin-top: .25rem; font-size: .78rem; }
#successPanel > .primary-button { display: block; margin: auto; }

footer {
  padding: 1.2rem max(1.2rem, calc((100vw - 1220px) / 2));
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  color: #c4d9e3; background: var(--navy); font-size: .72rem;
}
footer strong { margin-right: .7rem; color: white; }

@media (max-width: 900px) {
  .profile div, .mode-badge { display: none; }
  .hero { align-items: stretch; flex-direction: column; }
  .hero-stat { min-width: 0; }
  .steps { grid-template-columns: 1fr 1fr; }
  .connect-grid, .approval-grid, .review-layout { grid-template-columns: 1fr; }
  .account-strip { grid-template-columns: 1fr 1fr; }
  .integration-flow { grid-template-columns: 1fr; }
  .integration-flow i { transform: rotate(90deg); }
  .review-summary { grid-template-columns: 1fr 1fr; }
  .audit-card { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  main { width: calc(100% - 1rem); max-width: 1220px; }
  .topbar { padding: 0 .75rem; }
  .brand small, .icon-button { display: none; }
  .hero { margin-top: .75rem; border-radius: 20px; }
  .steps { grid-template-columns: 1fr; }
  .step small { display: none; }
  .section-heading, .fallback-box, footer { align-items: stretch; flex-direction: column; }
  .account-strip, .review-summary, .partner-details, .audit-card { grid-template-columns: 1fr; }
  .partner-head { grid-template-columns: auto 1fr; }
  .partner-tags { grid-column: 2; justify-content: flex-start; }
  .partner-details, .reasoning, .edit-row { margin-left: 0; }
  .audit-card div { border-right: 0; border-bottom: 1px solid var(--line); }
}
