/* BankPolicy Copilot — screen styles. */

:root {
  --bp-teal: #0b3d42;
  --bp-teal-hover: #0f4a50;
  --bp-teal-accent: #2e8189;
  --bp-teal-link: #14636b;
  --bp-bg: #f5f4ef;
  --bp-surface: #ffffff;
  --bp-line: #e3e1d9;
  --bp-field-line: #cfccc2;
  --bp-ink: #1f1e1d;
  --bp-muted: #6b6a66;
  --bp-on-teal: #b9d3d5;
  --bp-on-teal-dim: #8fb4b8;
  --bp-error-bg: #fbe6e3;
  --bp-error-line: #f0c8c2;
  --bp-error-ink: #8c2f22;
  --bp-shell-width: 1240px;
  --bp-topbar-height: 56px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bp-bg);
  color: var(--bp-ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--bp-teal-link);
}

:focus-visible {
  outline: 2px solid var(--bp-teal-accent);
  outline-offset: 2px;
}

.muted {
  color: var(--bp-muted);
}

/* ---------- Brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bp-teal-accent);
  color: var(--bp-teal);
}

.brand-mark svg {
  width: 17px;
  height: 17px;
  display: block;
}

.brand-text {
  font-size: 15px;
  color: var(--bp-on-teal);
  letter-spacing: 0.1px;
}

.brand-text strong {
  color: #fff;
  font-weight: 700;
}

/* ---------- 01 Sign in ---------- */

.login-body {
  background: var(--bp-bg);
}

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

.login-panel {
  flex: 0 0 40%;
  max-width: 40%;
  background: var(--bp-teal);
  color: #fff;
  padding: 44px 56px 40px;
  display: flex;
  flex-direction: column;
}

.login-pitch {
  margin-top: auto;
  max-width: 420px;
}

.login-pitch h1 {
  margin: 0 0 18px;
  font-size: 34px;
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.login-pitch p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--bp-on-teal);
}

.login-sandbox {
  margin: auto 0 0;
  padding-top: 32px;
  font-size: 12px;
  color: var(--bp-on-teal-dim);
}

.login-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-line);
  border-radius: 6px;
  padding: 28px 32px 30px;
  box-shadow: 0 1px 2px rgba(31, 30, 29, 0.04), 0 10px 28px rgba(11, 61, 66, 0.06);
}

.login-card h2 {
  margin: 0 0 20px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.login-note {
  margin: 16px 0 0;
  font-size: 12px;
  color: #8a8983;
}

/* ---------- Forms ---------- */

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #3a3936;
}

.field {
  display: block;
  width: 100%;
  margin-bottom: 16px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--bp-ink);
  background: #fff;
  border: 1px solid var(--bp-field-line);
  border-radius: 4px;
}

.field:focus {
  outline: none;
  border-color: var(--bp-teal-accent);
  box-shadow: 0 0 0 3px rgba(46, 129, 137, 0.18);
}

.alert-error {
  margin: 0 0 16px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--bp-error-ink);
  background: var(--bp-error-bg);
  border: 1px solid var(--bp-error-line);
  border-radius: 4px;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--bp-teal);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--bp-teal-hover);
}

/* ---------- Signed-in shell ---------- */

.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bp-teal);
}

.topbar-inner {
  display: flex;
  align-items: stretch;
  gap: 24px;
  height: var(--bp-topbar-height);
  max-width: var(--bp-shell-width);
  margin: 0 auto;
  padding: 0 28px;
}

.topbar .brand {
  align-self: center;
}

.mainnav {
  display: flex;
  align-items: stretch;
  gap: 2px;
}

.navlink {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13.5px;
  color: var(--bp-on-teal);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.navlink:hover {
  color: #fff;
}

.navlink.is-active {
  color: #fff;
  font-weight: 600;
  border-bottom-color: var(--bp-teal-accent);
}

.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.identity-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}

.identity-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
}

.identity-entitlement {
  font-size: 11px;
  color: var(--bp-on-teal-dim);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bp-teal-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.signout-form {
  margin: 0;
}

.signout {
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  color: #cfe3e4;
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

.signout:hover {
  color: #fff;
}

/* ---------- Page body ---------- */

.page {
  flex: 1;
  background: var(--bp-bg);
}

.page-inner {
  max-width: var(--bp-shell-width);
  margin: 0 auto;
  padding: 22px 28px 40px;
}

.page-head {
  margin-bottom: 18px;
}

.page-date {
  margin: 0 0 2px;
  font-size: 12.5px;
  color: var(--bp-muted);
}

.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-line);
  border-radius: 5px;
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(31, 30, 29, 0.04);
}

.placeholder-card h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.placeholder-card p {
  margin: 0 0 6px;
}

.placeholder-card p:last-child {
  margin-bottom: 0;
}

.page-head--split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-meta {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--bp-muted);
}

.page-meta a {
  color: inherit;
  text-decoration: none;
}

.page-meta a:hover {
  text-decoration: underline;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--bp-muted);
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.card-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card-head a {
  font-size: 12.5px;
  text-decoration: none;
}

.card-head a:hover {
  text-decoration: underline;
}

.card-empty {
  margin: 0;
  font-size: 13px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-side {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
}

.grid-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 16px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

.btn-teal {
  color: #fff;
  background: var(--bp-teal);
}

.btn-teal:hover {
  background: var(--bp-teal-hover);
}

.btn-outline {
  color: var(--bp-ink);
  background: #fff;
  border-color: var(--bp-field-line);
}

.btn-outline:hover {
  border-color: #b4b0a5;
  background: #fbfaf7;
}

.btn-danger {
  color: #fff;
  background: #a3281a;
}

.btn-danger:hover {
  background: #8d2115;
}

.btn-block {
  display: flex;
  width: 100%;
  margin-bottom: 8px;
}

.btn-block:last-child {
  margin-bottom: 0;
}

.btn-icon {
  display: inline-flex;
}

.btn-icon svg {
  display: block;
  width: 13px;
  height: 13px;
}

/* ---------- Search and filters ---------- */

.searchbar {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}

.searchbar .field {
  width: 348px;
  margin-bottom: 0;
  padding: 8px 12px;
}

.search-card {
  padding: 16px 18px;
  margin-bottom: 14px;
}

.search-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.search-field {
  flex: 1;
}

.search-form .field {
  margin-bottom: 0;
}

.filter-card {
  padding: 16px 18px;
  margin-bottom: 14px;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.filter-form .field {
  margin-bottom: 0;
}

.filter-form input[type="date"].field {
  min-height: 38px;
  color-scheme: light;
}

.filter-submit {
  width: 100%;
  padding: 9px 16px;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6b6a66 50%),
    linear-gradient(135deg, #6b6a66 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ---------- Counter cards ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 14px 18px 16px;
}

.stat-label {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--bp-muted);
}

.stat-value {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-value--alert {
  color: #a3281a;
}

.stat-note {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--bp-muted);
}

/* ---------- Tables ---------- */

.card--table {
  padding: 16px 0 6px;
}

.card--table > .card-head {
  padding: 0 20px 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 0 12px 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bp-muted);
  text-align: left;
  border-bottom: 1px solid var(--bp-line);
  white-space: nowrap;
}

.table td {
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid #f1f0ec;
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.card--table .table th:first-child,
.card--table .table td:first-child {
  padding-left: 20px;
}

.card--table .table th:last-child,
.card--table .table td:last-child {
  padding-right: 20px;
}

.table--headless td {
  padding-top: 11px;
  padding-bottom: 11px;
}

.table .num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .shrink {
  width: 1%;
  white-space: nowrap;
}

.table-foot {
  margin: 10px 0 8px;
  padding: 0 20px;
  font-size: 11.5px;
}

.nowrap {
  white-space: nowrap;
}

.strong {
  font-weight: 600;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  border-radius: 3px;
  background: #e7e5de;
  color: #56544d;
}

.badge--settled,
.badge--verified {
  background: #d6e9dd;
  color: #1d5a42;
}

.badge--executed {
  background: #dcecd4;
  color: #35602a;
}

.badge--pending,
.badge--under-review {
  background: #fbeaca;
  color: #7a5713;
}

.badge--scheduled,
.badge--open {
  background: #dfe6ed;
  color: #40536a;
}

.badge--in-progress,
.badge--awaiting-approval {
  background: #d9e6f3;
  color: #2c5279;
}

.badge--returned {
  background: #e7dcf1;
  color: #55407c;
}

.badge--cancelled,
.badge--closed {
  background: #e7e5de;
  color: #56544d;
}

.badge--expired,
.badge--rejected,
.badge--high {
  background: #f8dcd6;
  color: #8d2e20;
}

.badge--fraud {
  background: #9b2c1f;
  color: #fff;
}

.badge--approved {
  background: #d6e9dd;
  color: #1d5a42;
}

.badge--draft {
  background: #f3e4d0;
  color: #8a5520;
}

.badge--superseded {
  background: #e7e5de;
  color: #6b6a66;
}

/* ---------- Notices ---------- */

.notice {
  margin: 0 0 16px;
  padding: 11px 14px;
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: 4px;
}

.notice-info {
  color: #235070;
  background: #e8f1f8;
  border-color: #cddfee;
}

.notice-info .notice-title {
  margin: 0 0 2px;
  font-weight: 700;
}

.notice-info .notice-body {
  margin: 0;
}

.notice-warn {
  display: flex;
  gap: 11px;
  color: #5c5548;
  background: #fdf5e4;
  border-color: #eedfb6;
}

.notice-icon {
  flex: none;
  padding-top: 1px;
  color: #8a6a1e;
}

.notice-icon svg {
  display: block;
  width: 15px;
  height: 15px;
}

.notice-title {
  margin: 0 0 3px;
  font-weight: 700;
  color: #6b4f14;
}

.notice-body {
  margin: 0;
  line-height: 1.5;
}

.notice-danger {
  display: flex;
  gap: 11px;
  color: #7a3327;
  background: var(--bp-error-bg);
  border-color: var(--bp-error-line);
}

.notice-danger .notice-icon {
  color: #a3281a;
}

.notice-danger .notice-title {
  color: #8c2f22;
}

.notice-danger a {
  color: #8c2f22;
}

/* ---------- 07 Cancellation modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(31, 30, 29, 0.42);
}

.modal {
  width: 100%;
  max-width: 424px;
  padding: 22px 24px 24px;
  background: var(--bp-surface);
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(11, 61, 66, 0.28);
}

.modal-title {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.modal-body {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
  color: #4a4844;
}

.modal .field {
  margin-bottom: 14px;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 18px;
  font-size: 12.5px;
  line-height: 1.4;
}

.checkbox input {
  flex: none;
  width: 15px;
  height: 15px;
  margin: 1px 0 0;
  accent-color: var(--bp-teal);
}

.modal-error {
  margin: -8px 0 14px;
  font-size: 12.5px;
  color: var(--bp-error-ink);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.is-disabled {
  color: #9b9992;
  background: #fbfaf7;
  border-color: var(--bp-line);
  cursor: not-allowed;
}

.action-form {
  margin: 0 0 8px;
}

.action-form:last-child {
  margin-bottom: 0;
}

.clear-fraud-copy {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.5;
}

/* ---------- 08 Recovery eligibility ---------- */

.grid-2--recovery {
  align-items: start;
}

.check-stamp {
  margin: 0;
  font-size: 11.5px;
}

.verdict {
  display: flex;
  gap: 11px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 4px;
}

.verdict--ok {
  color: #1d5a42;
  background: #e4f2e9;
  border-color: #c3e0cf;
}

.verdict--fail {
  color: #7a3327;
  background: var(--bp-error-bg);
  border-color: var(--bp-error-line);
}

.verdict-icon {
  flex: none;
  padding-top: 2px;
}

.verdict-icon svg {
  display: block;
  width: 15px;
  height: 15px;
}

.verdict-title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
}

.verdict-body {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: 13px;
  border-bottom: 1px solid #f1f0ec;
}

.checklist-row:last-child {
  border-bottom: 0;
}

.checklist-verdict {
  font-weight: 600;
  white-space: nowrap;
}

.checklist-row--fail .checklist-label {
  color: #7a3327;
}

.checklist-row--fail .checklist-verdict {
  color: #a3281a;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.card-foot {
  margin: 14px 0 0;
  padding-top: 12px;
  font-size: 11.5px;
  line-height: 1.5;
  border-top: 1px solid var(--bp-line);
}

.textarea {
  min-height: 92px;
  margin-bottom: 14px;
  line-height: 1.5;
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-actions--split {
  justify-content: flex-start;
}

.field-hint {
  margin: -8px 0 14px;
  font-size: 11.5px;
}

/* ---------- 10 Case detail ---------- */

.grid-detail--case {
  grid-template-columns: minmax(0, 1fr) 420px;
}

.kv--case {
  grid-template-columns: 148px minmax(0, 1fr);
}

.card-subtitle {
  margin: 20px 0 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--bp-muted);
}

.note {
  padding: 11px 13px;
  margin-bottom: 10px;
  background: #faf9f5;
  border: 1px solid var(--bp-line);
  border-radius: 4px;
}

.note:last-child {
  margin-bottom: 0;
}

.note-head {
  margin: 0 0 4px;
  font-size: 11.5px;
}

.note-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.filter-form--cases {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  justify-content: start;
}

.filter-form--cases .filter-submit {
  width: auto;
}

.timeline-step--pending::before {
  background: #c6c4bb;
}

.timeline-step--pending .timeline-label {
  color: var(--bp-muted);
  font-weight: 500;
}

/* ---------- Key/value lists ---------- */

.kv {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  margin: 0;
  row-gap: 10px;
  column-gap: 12px;
  font-size: 13px;
}

.kv--wide {
  grid-template-columns: 116px minmax(0, 1fr);
}

.kv dt {
  color: var(--bp-muted);
}

.kv dd {
  margin: 0;
}

/* ---------- Accounts ---------- */

.account-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid #f1f0ec;
}

.account-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.account-id,
.account-number,
.account-balance,
.account-status {
  margin: 0;
}

.account-number {
  font-size: 11px;
}

.account-money {
  text-align: right;
}

.account-balance {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.account-status {
  font-size: 11px;
}

/* ---------- Transfer detail ---------- */

.transfer-head {
  align-items: flex-start;
}

.transfer-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transfer-title .page-title {
  font-size: 26px;
}

.transfer-amount {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.timeline {
  margin: 0;
  padding: 0 0 0 16px;
  list-style: none;
}

.timeline-step {
  position: relative;
  padding-bottom: 14px;
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.timeline-step::before {
  content: "";
  position: absolute;
  top: 4px;
  left: -20px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bp-teal);
}

.timeline-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.timeline-time {
  margin: 1px 0 0;
  font-size: 11.5px;
}

/* ---------- Status bar ---------- */

.statusbar {
  background: #efeee8;
  border-top: 1px solid var(--bp-line);
  color: var(--bp-muted);
  font-size: 11.5px;
}

.statusbar-inner {
  display: flex;
  flex-wrap: wrap;
  max-width: var(--bp-shell-width);
  margin: 0 auto;
  padding: 8px 28px;
}

.statusbar-inner span + span::before {
  content: "·";
  margin: 0 8px;
  color: #b5b3aa;
}

.statusbar-req {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

/* ---------- 11 Compose notification ---------- */

.grid-2--notify {
  grid-template-columns: 420px minmax(0, 1fr);
  align-items: start;
}

.notify-form,
.notify-preview {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.template-set {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-option {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--bp-line);
  border-radius: 6px;
  font-size: 13.5px;
  cursor: pointer;
}

.template-option.is-selected {
  border-color: var(--bp-teal);
  border-width: 2px;
  padding: 9px 11px;
}

.template-option input {
  accent-color: var(--bp-teal);
}

.notify-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.preview-body {
  padding: 18px 20px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  background: #faf9f6;
  border: 1px solid var(--bp-line);
  border-radius: 6px;
}

.preview-mark {
  background: #d1e9ff;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* ---------- 12 Policy library ---------- */

.policy-toggle {
  margin: 0;
}

.checkbox--inline {
  margin: 0;
  align-items: center;
}

.table .strong {
  font-weight: 600;
}

.table tr.is-muted {
  color: #5a6472;
}

.table tr.is-selected td {
  background: #f3f8f9;
}

.policy-body {
  white-space: pre-wrap;
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.6;
  max-width: 900px;
}

/* ---------- 13 Audit log ---------- */

.filter-form--audit {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  justify-content: start;
}

.filter-form--audit .filter-submit {
  width: auto;
}

.table--audit {
  font-size: 12.5px;
}

.table--audit td {
  vertical-align: top;
}

.audit-footnote {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- 14 Policy assistant (RAG) ---------- */

.assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}

.assistant-chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 520px;
  /* The card never grows past 800px: the conversation scrolls inside it, while the
     title, the evidence hint and the question box stay in view. */
  max-height: 800px;
}

.assistant-chat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.assistant-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.assistant-spark {
  display: inline-flex;
  color: #5b4db8;
}

.assistant-meta {
  margin: 0;
  font-size: 12.5px;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;          /* lets the flex child shrink so it can scroll */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;     /* room for the scrollbar beside the bubbles */
  scroll-padding-bottom: 8px;
}

.chat-bubble {
  max-width: 92%;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.55;
  border-radius: 10px;
}

.chat-bubble--user {
  align-self: flex-end;
  background: var(--bp-teal);
  color: #fff;
  border-bottom-right-radius: 3px;
}

.chat-bubble--assistant {
  align-self: flex-start;
  background: #f0f0ff;
  color: var(--bp-ink);
  border: 1px solid #dcdcf5;
  border-bottom-left-radius: 3px;
}

.assistant-cite {
  color: var(--bp-teal-link);
  font-weight: 600;
  text-decoration: none;
}

.assistant-cite:hover {
  text-decoration: underline;
}

.chat-turn--assistant {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.chat-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge--assist-confidence,
.badge--assist-escalation {
  background: #e8e6fa;
  color: #4a3f8c;
}

.badge--assist-validated {
  background: #d6e9dd;
  color: #1d5a42;
}

.chat-feedback-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.chat-feedback {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn-compact {
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 600;
  min-width: 44px;
}

.feedback-ack {
  margin: 0;
  font-size: 12.5px;
}

.assistant-hint {
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #4a3f8c;
  background: #f7f6ff;
  border: 1px solid #d8d6f0;
  border-radius: 6px;
}

.assistant-ask {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.ask-field {
  margin: 0;
  flex: 1;
}

.assistant-evidence {
  padding: 4px 6px 0 2px;
  /* Like the conversation: at most 800px tall, the evidence scrolls inside the panel
     and its title stays in view. */
  max-height: 800px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.evidence-title {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bp-bg);
  padding: 4px 0 8px;
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}

.evidence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.evidence-card {
  padding: 12px 14px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-line);
  border-radius: 6px;
}

.evidence-card.is-uncited {
  border-style: dashed;
  color: #8a8983;
  background: #faf9f6;
}

.evidence-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
}

.evidence-rank {
  color: var(--bp-muted);
  font-weight: 500;
  white-space: nowrap;
}

.evidence-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.evidence-meta {
  margin: 16px 0 0;
  display: grid;
  gap: 4px;
  font-size: 11.5px;
  color: var(--bp-muted);
}

.evidence-meta div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 8px;
}

.evidence-meta dt {
  margin: 0;
  font-weight: 500;
}

.evidence-meta dd {
  margin: 0;
}

.evidence-agent-link {
  margin: 14px 0 0;
  font-size: 12.5px;
}

/* ---------- 15 Agent run ---------- */

.agent-head {
  align-items: flex-start;
}

.agent-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.badge--agent-status {
  background: #e8e6fa;
  color: #4a3f8c;
  padding: 6px 12px;
  font-size: 12.5px;
}

.agent-plan {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: #f0f0ff;
  border: 1px solid #dcdcf5;
  border-radius: 6px;
}

.agent-plan-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.agent-plan-body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
}

.table--agent {
  font-size: 13px;
}

.badge--tool-read {
  background: #d6e9dd;
  color: #1d5a42;
}

.badge--tool-write {
  background: #f5e6d3;
  color: #8a5520;
}

.obs--ok {
  color: #1d5a42;
  font-weight: 600;
}

.obs--wait {
  color: #8a5520;
  font-weight: 600;
}

.obs--muted {
  color: var(--bp-muted);
}

.agent-approve {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0 0;
  padding: 14px 16px;
  background: #fffbeb;
  border: 1px solid #e8d48b;
  border-radius: 6px;
}

.agent-approve-copy {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}

.agent-lock {
  display: inline-flex;
  color: #a67c1a;
  margin-top: 2px;
  flex-shrink: 0;
}

.agent-approve-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.agent-approve-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.agent-approve-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.agent-limits {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- Multi-agent supervisor ---------- */

.multi-supervisor {
  margin: 0 0 16px;
  padding: 16px 18px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-line);
}

.badge--specialist-done {
  background: #d6e9dd;
  color: #1d5a42;
}

.badge--specialist-active {
  background: #f5e6d3;
  color: #8a5520;
}

.badge--specialist-waiting,
.badge--specialist-blocked {
  background: #eceff3;
  color: #5a6570;
}

/* ---------- 16 Run record ---------- */

.run-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.metric-card {
  padding: 14px 16px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-line);
  border-radius: 6px;
}

.metric-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bp-muted);
}

.metric-value {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.metric-value--ok {
  color: #1d5a42;
}

.table--spans {
  font-size: 13px;
}

@media (max-width: 1080px) {
  .assistant-layout,
  .metric-grid,
  .stat-grid,
  .grid-2,
  .grid-side,
  .grid-detail,
  .grid-2--notify {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-form--audit {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-submit {
    grid-column: 2;
    justify-self: end;
  }
}

@media (max-width: 900px) {
  .login {
    flex-direction: column;
  }

  .page-head--split,
  .search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .searchbar .field {
    width: 100%;
  }

  .login-panel {
    flex: none;
    max-width: none;
    padding: 32px 28px;
  }

  .login-pitch h1 {
    font-size: 28px;
  }

  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
  }

  .identity {
    margin-left: 0;
  }
}

/* ---------- Training Lab, run record, GenAI evidence screens ---------- */

.lab-body .page-inner > .card,
.lab-body .page-inner > form > .card,
.lab-body .page-inner > section {
  margin-bottom: 16px;
}

.lab-body .kv > div,
.lab-body .kv--wide > div {
  display: contents;
}

.lab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--bp-line);
}

.lab-nav-link {
  padding: 8px 12px;
  color: var(--bp-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.lab-nav-link.is-active {
  color: var(--bp-teal);
  border-bottom-color: var(--bp-teal-accent);
  font-weight: 600;
}

.lab-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin: 0 0 14px;
  padding: 8px 14px;
  border: 1px solid var(--bp-line);
  border-radius: 5px;
  background: var(--bp-surface);
  font-size: 13px;
}

.lab-banner--active {
  border-color: #e3c27a;
  background: #fdf6e3;
}

.lab-banner-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bp-muted);
}

.lab-banner-link {
  margin-left: auto;
}

.chip {
  display: inline-block;
  padding: 1px 7px;
  margin: 1px 2px 1px 0;
  border-radius: 10px;
  border: 1px solid var(--bp-line);
  background: #f3f2ed;
  font-size: 12px;
  line-height: 1.5;
}

.chip--ok {
  background: #e3f1ea;
  border-color: #bfdccd;
  color: #1d5a42;
}

.chip--fail {
  background: var(--bp-error-bg);
  border-color: var(--bp-error-line);
  color: var(--bp-error-ink);
}

.chip--fault {
  background: #fdf0d8;
  border-color: #ecd29c;
  color: #6d4b0c;
}

.section-title {
  margin: 18px 0 10px;
  font-size: 15px;
}

.section-title--sheet {
  margin-top: 28px;
  font-size: 18px;
}

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

.pack-option {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 2px 8px;
  padding: 8px 10px;
  border: 1px solid var(--bp-line);
  border-radius: 5px;
  cursor: pointer;
}

.pack-option > :not(input) {
  grid-column: 2;
}

.pack-option.is-selected {
  border-color: var(--bp-teal-accent);
  background: #f3f8f9;
}

.override-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 16px;
  margin: 8px 0;
}

.small {
  font-size: 12px;
}

.code {
  margin: 6px 0 0;
  padding: 10px 12px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7f6f2;
  border: 1px solid var(--bp-line);
  border-radius: 4px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.code--source {
  max-height: 640px;
}

.code--diff .diff-add {
  color: #1d5a42;
  background: #e3f1ea;
}

.code--diff .diff-del {
  color: var(--bp-error-ink);
  background: var(--bp-error-bg);
}

.details {
  margin: 8px 0 0;
}

.details > summary {
  cursor: pointer;
  color: var(--bp-teal-link);
}

.details--inline {
  margin: 0;
}

.metric-value--bad {
  color: var(--bp-error-ink);
}

.text-fail {
  color: var(--bp-error-ink);
}

.question-line {
  margin: 0 0 8px;
}

.chat-bubble--contained {
  border-color: var(--bp-error-line);
  background: var(--bp-error-bg);
}

.attempt + .attempt {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--bp-line);
}

.attempt-title {
  margin: 0 0 8px;
  font-size: 14px;
}

.table--compact th,
.table--compact td {
  padding-top: 6px;
  padding-bottom: 6px;
}

.row-fail td {
  background: #fdf3f1;
}

.gold {
  color: #1d5a42;
  font-weight: 700;
}

.distractor {
  color: #8a5a00;
}

.ingest-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.chunk-card {
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--bp-line);
  border-left: 3px solid #bfdccd;
  border-radius: 4px;
}

.chunk-card--fail {
  border-left-color: var(--bp-error-ink);
  background: #fdf8f7;
}

.chunk-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.steps {
  margin: 10px 0 0;
  padding-left: 20px;
}

.steps li + li {
  margin-top: 4px;
}

@media (max-width: 1080px) {
  .ingest-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A slow form that is working: see the submit handler in base.html. */
form[aria-busy="true"] button[disabled] {
  cursor: progress;
  opacity: 0.75;
}

.busy-note {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--muted, #5b6770);
}

