/* Layout glue and the demo control bar. Everything else is SLDS. */

html, body { height: 100%; }
body {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 1024px;
  overflow: hidden;
  background: #f3f3f3;
}
#app { overflow: auto; position: relative; }

/* The SLDS global header is fixed to the window by default. Here it sticks to
   the top of the app area instead, so it sits below the demo bar. */
#app .slds-global-header_container { position: sticky; top: 0; }
.app-logo-text { font-size: 1rem; font-weight: 700; color: #032d60; white-space: nowrap; }
.app-main { padding: 0.75rem; }


/* Toasts sit bottom center and stack upward. */
#toasts .slds-notify_container { top: auto; bottom: 1.5rem; display: flex; flex-direction: column-reverse; align-items: center; pointer-events: none; }
#toasts .slds-notify { pointer-events: auto; margin: 0.25rem 0; }

/* ---- Demo control bar: deliberately not Lightning ---- */
.demo-bar {
  display: flex; align-items: center; gap: 0.75rem;
  background: #1e293b; color: #cbd5e1;
  font: 12px/1.2 system-ui, -apple-system, 'Segoe UI', sans-serif;
  padding: 0.3rem 0.75rem;
}
.demo-bar__title { color: #f8fafc; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; }
.demo-bar label { display: inline-flex; align-items: center; gap: 0.35rem; }
.demo-bar select, .demo-bar button {
  font: inherit; color: #f1f5f9; background: #334155; border: 1px solid #475569; border-radius: 3px; padding: 0.15rem 0.4rem;
}
.demo-bar button { cursor: pointer; }
.demo-bar button:hover, .demo-bar select:hover { background: #475569; }
.demo-bar button[aria-pressed='true'] { background: #0f766e; border-color: #14b8a6; }
.demo-bar :focus-visible, .demo-panel :focus-visible { outline: 2px solid #5eead4; outline-offset: 1px; }
.demo-bar__count { display: inline-block; min-width: 1.2em; padding: 0 0.3em; margin-left: 0.25rem; border-radius: 0.6em; background: #f59e0b; color: #1e293b; font-weight: 700; text-align: center; }
.demo-bar__count[data-count='0'] { background: #64748b; color: #f1f5f9; }
.demo-bar__spacer { flex: 1; }
.demo-bar__hint { color: #94a3b8; }
.demo-bar__label { color: #fbbf24; font-weight: 600; white-space: nowrap; }

.demo-panel {
  position: fixed; z-index: 9000; right: 0.75rem; width: 24rem; max-height: 60vh; overflow: auto;
  background: #1e293b; color: #e2e8f0; border: 1px solid #475569; border-radius: 6px;
  font: 12px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.demo-panel header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem; border-bottom: 1px solid #475569; font-weight: 700; color: #f8fafc; }
.demo-panel button { font: inherit; color: #f1f5f9; background: #334155; border: 1px solid #475569; border-radius: 3px; padding: 0.15rem 0.5rem; cursor: pointer; }
.demo-panel button:disabled { opacity: 0.4; cursor: default; }
.demo-panel__body { padding: 0.6rem 0.75rem; }
.demo-panel--outbox { top: 2.25rem; }
.demo-panel--guide { bottom: 0.75rem; }
.demo-panel--guide-collapsed { width: auto; }
.demo-panel--guide-collapsed button { border: 0; background: transparent; padding: 0.4rem 0.75rem; }
.demo-outbox__item { padding: 0.5rem 0; border-bottom: 1px solid #334155; }
.demo-outbox__item:last-child { border-bottom: 0; }
.demo-outbox__meta { color: #94a3b8; }
.demo-outbox__subject { color: #f8fafc; font-weight: 600; }
.demo-guide__as { color: #5eead4; font-weight: 600; }
.demo-guide__title { color: #f8fafc; font-weight: 700; margin: 0.15rem 0 0.35rem; font-size: 13px; }
.demo-guide__nav { display: flex; justify-content: space-between; align-items: center; margin-top: 0.6rem; color: #94a3b8; }

/* Presenter mode: D hides every demo control. */
body.demo-bar-hidden #demo-bar, body.demo-bar-hidden #demo-panels { display: none; }

/* Credit console: queue and workspace fill the window and scroll independently. */
.console { display: grid; grid-template-columns: 21rem 1fr; gap: 0.75rem; height: calc(100vh - var(--app-top, 2rem) - 8.5rem); min-height: 22rem; }
.console__list { overflow: auto; background: #fff; border-radius: 0.25rem; }
.console__workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.console-workspace__scroll { flex: 1; overflow: auto; min-height: 0; }
.console-footer { background: #fff; border-top: 2px solid #c9c9c9; padding: 0.6rem 0.75rem; gap: 0.25rem; }
.app-notification a { white-space: normal; }
.policy-layout { display: grid; grid-template-columns: 1fr 22rem; gap: 0.75rem; align-items: start; }
.policy-layout__sim { position: sticky; top: 6rem; }
.setup-layout { display: grid; grid-template-columns: 16rem 1fr; gap: 0.75rem; align-items: start; }
tr.row-breach > * { background: #fef1ee; }

/* This SLDS version gives the modal close button a white background but leaves its icon white. */
.slds-modal__close .slds-button__icon { fill: #444; }

/* Guided demo strip: sits under the demo bar, never over the product. */
.demo-guide {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center;
  background: #0f172a; color: #e2e8f0; border-top: 1px solid #334155; border-bottom: 2px solid #14b8a6;
  font: 13px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif; padding: 0.5rem 0.75rem;
}
.demo-guide__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; }
.demo-guide__step { color: #94a3b8; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.demo-guide__as { color: #5eead4; font-weight: 600; }
.demo-guide__title { color: #f8fafc; font-weight: 700; font-size: 14px; }
.demo-guide__done { color: #1e293b; background: #5eead4; border-radius: 3px; padding: 0 0.4rem; font-weight: 700; }
.demo-guide__text { margin-top: 0.15rem; color: #cbd5e1; }
.demo-guide__lines { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; margin: 0.3rem 0 0 0; padding: 0; list-style: none; counter-reset: line; color: #f8fafc; font-weight: 600; }
.demo-guide__lines li { counter-increment: line; }
.demo-guide__lines li::before { content: counter(line); display: inline-block; width: 1.25rem; height: 1.25rem; line-height: 1.25rem; margin-right: 0.35rem; border-radius: 50%; background: #334155; color: #f8fafc; text-align: center; font-size: 11px; }
.demo-guide__tip { margin-top: 0.25rem; color: #94a3b8; font-style: italic; }
.demo-guide__nav { display: flex; gap: 0.4rem; white-space: nowrap; }
.demo-guide button { font: inherit; color: #f1f5f9; background: #334155; border: 1px solid #475569; border-radius: 3px; padding: 0.3rem 0.7rem; cursor: pointer; }
.demo-guide button:disabled { opacity: 0.4; cursor: default; }
.demo-guide button.demo-guide__next--ready { background: #0f766e; border-color: #14b8a6; font-weight: 700; }
.demo-guide :focus-visible { outline: 2px solid #5eead4; outline-offset: 1px; }

/* Stat tiles in the credit console */
.stat--good { border-color: #91db8b; background: #f3faf3; }
.stat--warn { border-color: #fcc003; background: #fff8e6; }
.stat--bad { border-color: #fe5c4c; background: #fef1ee; }

/* The credit agent's summary */
.memo { padding: 0.75rem 1rem; border-left: 4px solid #0176d3; background: #f3f7fb; border-radius: 0 0.25rem 0.25rem 0; }

/* Credit team dashboard tiles */
.dash-tile .slds-card { border-left: 4px solid #c9c9c9; }
.dash-tile--good .slds-card { border-left-color: #2e844a; }
.dash-tile--warn .slds-card { border-left-color: #dd7a01; }
.dash-tile--bad .slds-card { border-left-color: #ba0517; }

/* Console summary: verdict, signals, factors, drivers */
.verdict { height: 100%; padding: 0.9rem 1rem; border-radius: 0.5rem; border: 1px solid #c9c9c9; border-left-width: 5px; background: #fff; }
.verdict--good { border-left-color: #2e844a; }
.verdict--warn { border-left-color: #dd7a01; }
.verdict__amount { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.verdict__terms { font-size: 1rem; font-weight: 600; color: #444; }
.verdict__score { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.memo--compact { height: 100%; }
.memo__headline { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; }
.sig { margin: 0; padding: 0; list-style: none; }
.sig li { display: grid; grid-template-columns: 0.9rem 6.5rem 1fr; align-items: center; gap: 0.5rem; padding: 0.22rem 0; border-top: 1px solid #e5e5e5; }
.sig li:first-child { border-top: 0; }
.sig__dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; }
.sig__label { font-weight: 700; }
.factor { display: grid; grid-template-columns: 11rem 1fr 2.2rem; align-items: center; gap: 0.6rem; padding: 0.2rem 0; }
.factor__bar { height: 0.55rem; border-radius: 0.3rem; background: #ececec; overflow: hidden; }
.factor__bar > span { display: block; height: 100%; border-radius: 0.3rem; }
.factor__value { text-align: right; font-weight: 700; }
.drivers { margin: 0; padding: 0; list-style: none; }
.drivers li { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.5rem; border-radius: 0.25rem; margin-bottom: 0.2rem; background: #f3f3f3; }
.drivers li span { flex: 1; }
.drivers li em { font-style: normal; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #fff; background: #0176d3; padding: 0.05rem 0.4rem; border-radius: 0.6rem; }
.drivers li.is-binding { background: #eef4fb; }
.drivers li.is-ok strong { color: #2e844a; }
.drivers li.is-low strong { color: #dd7a01; }
.report h3 { font-size: 0.95rem; font-weight: 700; margin: 1rem 0 0.4rem; padding-bottom: 0.25rem; border-bottom: 1px solid #c9c9c9; }

/* Policy page: stacked bars, score ladder, movers */
.stack { display: flex; height: 0.8rem; border-radius: 0.4rem; overflow: hidden; background: #ececec; }
.stack > span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; margin-top: 0.3rem; font-size: 0.75rem; color: #444; }
.legend i, .mover__route i, .swatch { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 2px; margin-right: 0.3rem; vertical-align: baseline; }
.swatch { float: left; margin-top: 0.3rem; }
.ladder { position: relative; height: 1rem; border-radius: 0.5rem; overflow: hidden; background: #ececec; }
.ladder > span { position: absolute; top: 0; height: 100%; }
.ladder > em { position: absolute; top: 0; height: 100%; background: repeating-linear-gradient(135deg, rgba(255,255,255,0.55) 0 4px, transparent 4px 8px); }
.ladder__ticks { position: relative; height: 1rem; font-size: 0.7rem; color: #666; }
.ladder__ticks span { position: absolute; top: 0; transform: translateX(-50%); }
.ladder__ticks span:first-child { transform: none; }
.ladder__ticks span:last-child { transform: none; }
.mover { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; border-top: 1px solid #e5e5e5; font-size: 0.8rem; }
.mover__name { font-weight: 600; }
.mover__route { white-space: nowrap; color: #444; }
.row-breach td { background: #fef1ee; }
.row-breach td:first-child { box-shadow: inset 4px 0 0 #ba0517; }
