/* Boot, login, select controls, sidebar and topbar. */

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  background: var(--ps-page);
}

.boot-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 4px;
  border: 4px solid rgba(230, 94, 39, 0.18);
  border-top-color: var(--ps-orange);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.boot-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--ps-charcoal);
}

.boot-copy {
  font-size: 12px;
  font-weight: 600;
  color: var(--ps-muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--ps-page);
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 108px;
  padding: 20px 48px;
  border-bottom: 1px solid var(--ps-line);
  background: var(--ps-panel);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand-lockup img {
  height: 64px;
  width: auto;
  object-fit: contain;
}

.login-brand-divider {
  width: 1px;
  height: 61px;
  background: var(--ps-line-strong);
}

.foresight-identity {
  min-width: 250px;
}

.brand-title {
  color: var(--ps-charcoal);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.045em;
}

.brand-subtitle {
  margin-top: 5px;
  color: var(--ps-muted);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.login-main {
  width: min(1480px, calc(100% - 96px));
  margin: 54px auto 76px;
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(400px, 0.9fr);
  gap: 58px;
  align-items: stretch;
}

.showcase-panel {
  border: 1px solid var(--ps-line);
  border-radius: 16px;
  background: var(--ps-surface-soft);
  color: var(--ps-charcoal);
  padding: 48px 52px;
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-shadow: 0 18px 38px rgba(49, 85, 126, 0.055);
}

.eyebrow {
  color: var(--ps-orange-text);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.showcase-title {
  margin: 22px 0 18px;
  max-width: 720px;
  color: var(--ps-charcoal);
  font-size: clamp(38px, 4vw, 58px);
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.showcase-copy {
  max-width: 735px;
  color: var(--ps-muted);
  font-size: 17px;
  line-height: 1.58;
}

.login-flow {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) 36px minmax(132px, 1fr) 36px minmax(132px, 1fr) 36px minmax(132px, 1fr);
  align-items: center;
  gap: 0;
  margin-top: 46px;
}

.login-flow-step {
  min-height: 170px;
  padding: 18px 12px 16px;
  border: 1px solid var(--ps-line);
  border-radius: 14px;
  background: var(--ps-panel);
  text-align: center;
  box-shadow: 0 7px 18px rgba(52, 84, 122, 0.045);
}

.login-flow-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 10px;
  color: var(--ps-blue);
  background: var(--ps-blue-soft);
}

.login-flow-step strong {
  display: block;
  color: var(--ps-charcoal);
  font-size: 15px;
  font-weight: 800;
}

.login-flow-step span {
  display: block;
  margin-top: 8px;
  color: var(--ps-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.login-flow-connector {
  position: relative;
  height: 1px;
  background: var(--ps-blue);
}

.login-flow-connector::before,
.login-flow-connector::after {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 2px solid var(--ps-blue);
  border-radius: 50%;
  background: var(--ps-surface-soft);
  content: "";
  transform: translateY(-50%);
}

.login-flow-connector::before {
  left: -1px;
}
.login-flow-connector::after {
  right: -1px;
}

.login-capabilities {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 42px;
}

.login-capability {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 10px;
  border: 1px solid var(--ps-line);
  border-radius: 11px;
  color: var(--ps-blue);
  background: var(--ps-surface-soft);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.login-card {
  background: var(--ps-panel);
  border: 1px solid var(--ps-line);
  border-radius: 16px;
  padding: 46px 42px;
  box-shadow: 0 14px 32px rgba(42, 69, 105, 0.1);
}

.login-card h1 {
  margin: 0 0 12px;
  color: var(--ps-charcoal);
  font-size: 33px;
  letter-spacing: -0.04em;
  font-weight: 900;
}

.login-card p {
  margin: 0 0 34px;
  color: var(--ps-muted);
  font-size: 16px;
  line-height: 1.5;
}

.login-card .form-grid {
  display: grid;
  gap: 24px;
}

.login-card .field label {
  margin-bottom: 10px;
  color: var(--ps-charcoal);
  font-size: 13px;
  font-weight: 800;
}

.login-card .field input {
  min-height: 55px;
  border-color: var(--ps-line-strong);
  border-radius: 9px;
  background: var(--ps-input);
  color: var(--ps-charcoal);
  padding: 11px 16px;
  font-size: 17px;
  font-weight: 500;
}

.login-card .field input:focus {
  border-color: var(--ps-blue);
  box-shadow: 0 0 0 3px rgba(90, 164, 222, 0.16);
}

.login-card .form-actions {
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 30px;
}

.login-card .form-actions .btn {
  min-height: 56px;
  border-radius: 9px;
  font-size: 16px;
}

.login-card .error-text {
  margin-top: 10px;
}

.login-demo-access {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--ps-line);
  color: var(--ps-muted);
  font-size: 14px;
  line-height: 1.4;
}

.login-demo-access > i {
  flex: 0 0 auto;
  color: var(--ps-blue);
}

.login-demo-access strong {
  color: var(--ps-charcoal);
}

.field label,
.filter-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ps-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.field input,
.field select,
.filter-field input,
.filter-field select,
.filter-field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 7px;
  background: var(--ps-input);
  color: var(--ps-ink);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  outline: none;
  transition:
    border-color 0.14s,
    box-shadow 0.14s,
    background-color 0.14s;
}

.field select,
.filter-field select {
  min-height: 36px;
  padding-right: 34px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m7 10 5 5 5-5' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
}

.field input:hover,
.field select:hover,
.filter-field input:hover,
.filter-field select:hover,
.filter-field textarea:hover {
  border-color: var(--ps-line-strong);
  background-color: var(--ps-input);
}

.field input:focus,
.field select:focus,
.filter-field input:focus,
.filter-field select:focus,
.filter-field textarea:focus {
  border-color: rgba(23, 126, 137, 0.72);
  background-color: var(--ps-input);
  box-shadow: 0 0 0 3px rgba(23, 126, 137, 0.11);
}

.field select:focus,
.filter-field select:focus {
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m7 10 5 5 5-5' stroke='%23177e89' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.field select[multiple],
.filter-field select[multiple] {
  min-height: 132px;
  padding: 8px 10px;
  cursor: default;
  appearance: auto;
  background-image: none;
}

/* Modal selects intentionally use the browser-native indicator to avoid layered SVG arrows. */
.epi-dashboard-widget-modal select.epi-dashboard-modal-select {
  appearance: auto;
  -webkit-appearance: auto;
  padding-right: 36px;
  cursor: pointer;
  background-color: var(--ps-input);
  background-image: none !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center;
  background-size: auto;
}

.epi-dashboard-widget-modal select.epi-dashboard-modal-select:hover:not(:disabled) {
  border-color: rgba(36, 124, 138, 0.45);
}

.epi-dashboard-widget-modal select.epi-dashboard-modal-select:focus {
  background-image: none !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center;
}

.epi-dashboard-widget-modal select.epi-dashboard-modal-select:disabled {
  cursor: not-allowed;
  color: var(--ps-muted);
  background-color: #f1f5f7;
  background-image: none !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center;
}

.field input[type="checkbox"],
.filter-field input[type="checkbox"],
.field input[type="radio"],
.filter-field input[type="radio"] {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.smart-select {
  position: relative;
  width: 100%;
  z-index: 2;
}

.smart-select.open {
  z-index: 80;
}

.smart-select-trigger {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 7px;
  color: var(--ps-ink);
  background: var(--ps-input);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  box-shadow: none;
  transition:
    border-color 0.14s,
    box-shadow 0.14s,
    background-color 0.14s,
    border-radius 0.14s;
}

.smart-select-trigger:hover {
  border-color: var(--ps-line-strong);
  background: var(--ps-input);
}

.smart-select.open .smart-select-trigger,
.smart-select-trigger:focus-visible {
  border-color: rgba(23, 126, 137, 0.72);
  background: var(--ps-input);
  box-shadow: 0 0 0 3px rgba(23, 126, 137, 0.11);
}

.smart-select.open .smart-select-trigger {
  border-bottom-color: rgba(23, 126, 137, 0.28);
  border-radius: 7px 7px 0 0;
  box-shadow:
    0 0 0 3px rgba(23, 126, 137, 0.11),
    0 10px 24px rgba(31, 41, 51, 0.08);
}

.smart-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-select-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ps-teal-text);
  transition: transform 0.16s ease;
}

.smart-select.open .smart-select-chevron {
  transform: rotate(180deg);
}

.smart-select-menu {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  display: none;
  max-height: 268px;
  overflow: auto;
  padding: 4px 0 6px;
  border: 1px solid rgba(23, 126, 137, 0.72);
  border-top: 0;
  border-radius: 0 0 9px 9px;
  background: var(--ps-overlay);
  box-shadow: 0 18px 36px rgba(31, 41, 51, 0.16);
}

.smart-select.open .smart-select-menu {
  display: block;
}

.smart-select-option {
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  color: #24303d;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.28;
  text-align: left;
}

.smart-select-option span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.smart-select-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--ps-teal-dark, #0f5c65);
}

.smart-select-section-label {
  padding: 10px 12px 4px;
  color: var(--ps-muted, #6b7280);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.smart-select-section-label:not(:first-child) {
  border-top: 1px solid var(--ps-line, #e5e7eb);
  margin-top: 4px;
}

.smart-select-option:hover,
.smart-select-option:focus-visible {
  color: var(--ps-teal-dark);
  background: rgba(23, 126, 137, 0.08);
  outline: none;
}

.smart-select-option.active {
  color: var(--ps-teal-dark);
  background: rgba(23, 126, 137, 0.13);
  font-weight: 700;
}

.smart-select-empty {
  padding: 10px 12px;
  color: var(--ps-muted);
  font-size: 12px;
}

.smart-select.open .smart-select-menu {
  display: flex;
}
/* Menus are closed unless their owning smart-select is explicitly open. */
.smart-select-menu {
  display: none;
  flex-direction: column;
  overflow: hidden;
  max-height: 284px;
}
.smart-select-options {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--ps-line-strong) transparent;
}
.smart-select-options::-webkit-scrollbar {
  width: 8px;
}
.smart-select-options::-webkit-scrollbar-thumb {
  border: 2px solid var(--ps-overlay);
  border-radius: 999px;
  background: var(--ps-line-strong);
}
.smart-select-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin: 5px 7px;
  padding: 0 8px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 6px;
  color: #61727d;
  background: var(--ps-input);
}
.smart-select-search:focus-within {
  border-color: var(--foresight-select-focus);
  box-shadow: 0 0 0 2px rgba(14, 148, 136, 0.12);
}
.smart-select-search input {
  width: 100%;
  min-height: 30px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ps-ink);
  background: transparent;
  font:
    500 12px/1.2 Inter,
    sans-serif;
}
.smart-select-option {
  min-height: 37px;
  white-space: nowrap;
}

/* Shared native-select enhancement (D1). Contexts retain their existing widths. */
:root {
  --foresight-select-height: 37px;
  --foresight-select-radius: 8px;
  --foresight-select-border: var(--ps-line-strong);
  --foresight-select-focus: var(--ps-teal-text);
  --foresight-select-hover: var(--ps-teal-soft);
  --foresight-select-selected: var(--ps-teal-soft);
  --foresight-select-ink: var(--ps-charcoal);
  --foresight-select-menu-shadow: 0 12px 28px rgba(15, 35, 50, 0.16);
}
select.foresight-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  pointer-events: none !important;
  opacity: 0 !important;
}
.foresight-select {
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}
.foresight-select-trigger {
  width: 100%;
  min-height: var(--foresight-select-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--foresight-select-border);
  border-radius: var(--foresight-select-radius);
  color: var(--foresight-select-ink);
  background: var(--ps-input);
  font:
    500 13px/1.25 Inter,
    sans-serif;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.14s,
    box-shadow 0.14s,
    background-color 0.14s;
}
.foresight-select-trigger:hover {
  border-color: var(--ps-line-strong);
  background: var(--foresight-select-hover);
}
.foresight-select.is-open .foresight-select-trigger,
.foresight-select-trigger:focus-visible {
  border-color: var(--foresight-select-focus);
  box-shadow: 0 0 0 3px rgba(14, 148, 136, 0.14);
  outline: none;
}
.foresight-select.is-disabled .foresight-select-trigger {
  border-color: var(--ps-line);
  color: #9aa6ae;
  background: #f6f8f9;
  cursor: not-allowed;
}
.foresight-select.is-error .foresight-select-trigger {
  border-color: #dc5b5b;
}
.foresight-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.foresight-select-chevron {
  color: var(--ps-teal-text);
  font-size: 18px;
  line-height: 0.7;
  transform: translateY(-1px);
  transition: transform 0.14s ease;
}
.foresight-select.is-open .foresight-select-chevron {
  transform: rotate(180deg) translateY(1px);
}
.foresight-select-menu {
  position: fixed;
  /* Menus are portalled to body. Configure Card sits at 4000+, so this must
     clear modal stacking contexts while retaining the modal's own scrolling. */
  z-index: 4100;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  padding: 4px 0;
  border: 1px solid var(--foresight-select-border);
  border-radius: 10px;
  background: var(--ps-overlay);
  box-shadow: var(--foresight-select-menu-shadow);
}
.foresight-select-options {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--ps-line-strong) transparent;
}
.foresight-select-options::-webkit-scrollbar {
  width: 8px;
}
.foresight-select-options::-webkit-scrollbar-thumb {
  border: 2px solid var(--ps-overlay);
  border-radius: 999px;
  background: var(--ps-line-strong);
}
.foresight-select-option {
  width: 100%;
  min-height: 37px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 0;
  color: var(--foresight-select-ink);
  background: var(--ps-overlay);
  font:
    500 13px/1.25 Inter,
    sans-serif;
  text-align: left;
  cursor: pointer;
}
.foresight-select-option > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.foresight-select-option:hover,
.foresight-select-option.is-highlighted {
  background: var(--foresight-select-hover);
  outline: none;
}
.foresight-select-option.is-selected {
  color: var(--ps-teal-text);
  background: var(--foresight-select-selected);
  font-weight: 700;
}
.foresight-select-option.is-selected:hover,
.foresight-select-option.is-selected.is-highlighted {
  background: #d7eeeb;
}
.foresight-select-option:disabled {
  color: #a9b2b9;
  background: #fafbfb;
  cursor: not-allowed;
}
.foresight-select-check {
  width: 18px;
  color: var(--ps-teal-text);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}
.foresight-select-check.is-multi {
  height: 16px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 4px;
  font-size: 12px;
  line-height: 14px;
}
.foresight-select-option.is-selected .foresight-select-check.is-multi {
  border-color: #0e857f;
  background: #0e857f;
  color: #fff;
}
.foresight-select-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin: 5px 7px;
  padding: 0 8px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 6px;
  color: #61727d;
  background: var(--ps-input);
}
.foresight-select-search:focus-within {
  border-color: var(--foresight-select-focus);
  box-shadow: 0 0 0 2px rgba(14, 148, 136, 0.12);
}
.foresight-select-search input {
  width: 100%;
  min-height: 30px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--foresight-select-ink);
  background: transparent;
  font:
    500 12px/1.2 Inter,
    sans-serif;
}
.foresight-select-group {
  padding: 9px 11px 4px;
  color: #6b7882;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.foresight-select-empty {
  padding: 13px 11px;
  color: #6b7882;
  font-size: 12px;
}
.foresight-select-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-top: 1px solid var(--ps-line);
}
.foresight-select-footer button {
  border: 0;
  padding: 4px 6px;
  color: #57707a;
  background: transparent;
  font:
    600 12px Inter,
    sans-serif;
  cursor: pointer;
}
.foresight-select-footer .done {
  color: var(--ps-teal-text);
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 6px;
  background: var(--ps-panel);
  color: var(--ps-charcoal);
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  transition:
    transform 0.12s,
    border-color 0.12s,
    background 0.12s,
    color 0.12s,
    box-shadow 0.12s;
}

.btn:hover {
  border-color: var(--ps-orange);
  color: var(--ps-orange-text);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  border-color: var(--ps-orange);
  background: var(--ps-orange);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(230, 94, 39, 0.22);
}

.btn-primary:hover {
  background: var(--ps-orange);
  border-color: var(--ps-orange-dark);
  color: #ffffff;
}

.btn[disabled],
.btn[disabled]:hover {
  cursor: not-allowed;
  border-color: var(--ps-line-strong);
  background: var(--ps-raised);
  color: var(--ps-faint);
  box-shadow: none;
  transform: none;
}

.btn-danger {
  border-color: var(--ps-red);
  background: var(--ps-red);
  color: #fff;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
}

.foresight-confirm-backdrop {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 41, 55, 0.48);
  backdrop-filter: blur(2px);
}

.foresight-confirm-dialog {
  width: min(100%, 470px);
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 14px;
  background: var(--ps-panel);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}

.foresight-confirm-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--ps-orange-dark);
  background: var(--ps-accent-soft);
}

.foresight-confirm-icon.danger {
  color: var(--ps-red);
  background: #fef2f2;
}

.foresight-confirm-dialog h2 {
  margin: 2px 0 7px;
  color: var(--ps-ink);
  font-size: 18px;
}

.foresight-confirm-dialog p {
  margin: 0;
  color: var(--ps-charcoal);
  line-height: 1.55;
}

.foresight-confirm-dialog small {
  display: block;
  margin-top: 7px;
  color: var(--ps-muted);
  line-height: 1.45;
}

.foresight-confirm-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
}

.btn-teal {
  border-color: var(--ps-teal);
  background: var(--ps-teal);
  color: #ffffff;
}

.btn-teal:hover {
  border-color: var(--ps-teal-dark);
  background: var(--ps-teal);
  color: #ffffff;
}

.btn-saved {
  border-color: var(--ps-green);
  background: var(--ps-green);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.22);
}

.btn-saved:hover {
  border-color: #059669;
  background: #059669;
  color: #ffffff;
}

.btn-ghost {
  background: transparent;
}

.btn-icon {
  width: 38px;
  padding: 0;
}

.hint-box {
  margin-top: 18px;
  padding: 13px;
  border: 1px solid var(--ps-line);
  border-radius: 6px;
  background: var(--ps-surface-soft);
  color: #626c77;
  font-size: 12px;
  line-height: 1.65;
}

.error-text {
  min-height: 18px;
  margin-top: 12px;
  color: var(--ps-red);
  font-size: 12px;
  font-weight: 800;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  transition: grid-template-columns 0.18s ease;
}

.app-shell-topnav {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--ps-line);
  background: var(--ps-sidebar);
  color: var(--ps-ink);
  box-shadow: 8px 0 24px rgba(31, 41, 55, 0.03);
  transition: width 0.18s ease;
}

.sidebar-brand {
  min-height: var(--shell-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 12px 18px 18px;
  border-bottom: 1px solid var(--ps-line);
  background: var(--ps-header);
}

.sidebar-brand img {
  height: 34px;
  width: auto;
  max-width: 188px;
  object-fit: contain;
  min-width: 0;
}

.sidebar-brand-lockup {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.sidebar-foresight-label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sidebar-foresight-label strong {
  color: var(--ps-ink);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.035em;
}

.sidebar-foresight-label span {
  overflow: hidden;
  color: var(--ps-faint);
  font-size: 9.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 8px;
  color: var(--ps-muted);
  background: var(--ps-panel);
  transition:
    border-color 0.14s,
    background-color 0.14s,
    color 0.14s,
    box-shadow 0.14s;
}

.sidebar-toggle svg {
  width: 22px !important;
  height: 22px !important;
  stroke-width: 1.85;
}

.sidebar-toggle:hover {
  border-color: var(--ps-teal);
  color: var(--ps-teal-dark);
  background: var(--ps-teal-soft);
  box-shadow: 0 0 0 3px rgba(36, 124, 138, 0.08);
}

.nav-label {
  padding: 16px 18px 8px;
  color: var(--ps-faint);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav-list {
  display: grid;
  gap: 5px;
  padding: 0 12px;
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ps-muted);
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-button svg {
  flex: 0 0 auto;
}

.nav-button:hover,
.nav-button.active {
  color: var(--ps-teal-dark);
  background: var(--ps-sidebar-active);
  border-color: #d7e7f7;
  border-left-color: var(--ps-orange);
}

.nav-button.active {
  background: var(--ps-accent-soft);
  border-color: rgba(217, 101, 50, 0.28);
  border-left-color: var(--ps-orange);
  box-shadow: 0 3px 10px rgba(217, 101, 50, 0.08);
}

.user-panel {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--ps-line);
  background: var(--ps-sidebar);
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(230, 94, 39, 0.72);
  border-radius: 50%;
  color: var(--ps-orange-dark);
  background: rgba(217, 101, 50, 0.1);
  font-weight: 900;
}

.user-meta {
  min-width: 0;
  flex: 1;
}

.user-name {
  overflow: hidden;
  color: var(--ps-ink);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  margin-top: 2px;
  color: var(--ps-faint);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.user-panel .btn-icon {
  flex: 0 0 auto;
  border-color: var(--ps-line-strong);
  color: var(--ps-muted);
  background: var(--ps-panel);
}

.user-panel .btn-icon:hover {
  border-color: var(--ps-orange);
  color: var(--ps-orange-dark);
  background: var(--ps-accent-soft);
  box-shadow: 0 0 0 3px rgba(217, 101, 50, 0.1);
}

.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 18px 10px;
}

.sidebar-collapsed .sidebar-brand img,
.sidebar-collapsed .sidebar-foresight-label,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-button span,
.sidebar-collapsed .user-meta,
.sidebar-collapsed .avatar {
  display: none;
}

.sidebar-collapsed .nav-list {
  padding: 14px 10px 0;
}

.sidebar-collapsed .nav-button {
  justify-content: flex-end;
  gap: 0;
  min-height: 42px;
  padding: 10px 14px 10px 8px;
  border-left-width: 0;
  border-right: 3px solid transparent;
}

.sidebar-collapsed .nav-button:hover,
.sidebar-collapsed .nav-button.active {
  border-left-color: transparent;
  border-right-color: var(--ps-orange);
}

.sidebar-collapsed .user-panel {
  justify-content: flex-end;
  padding: 12px 10px;
}

.sidebar-collapsed .user-panel .btn-icon {
  margin-left: auto;
}

.main {
  min-width: 0;
  background: var(--ps-page);
}

.ask-foresight-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid #166773;
  border-radius: 999px;
  background: var(--ps-teal);
  box-shadow: 0 7px 18px rgba(21, 92, 103, 0.24);
  color: var(--ps-white);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.ask-foresight-launcher:hover {
  background: var(--ps-teal);
  box-shadow: 0 9px 22px rgba(21, 92, 103, 0.28);
}

.ask-foresight-launcher:focus-visible {
  outline: 3px solid rgba(36, 124, 138, 0.25);
  outline-offset: 3px;
}

.ask-foresight-launcher svg {
  flex: 0 0 auto;
}

.ask-foresight-chat {
  position: fixed;
  right: 24px;
  bottom: 72px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 104px));
  overflow: hidden;
  border: 1px solid var(--ps-line-strong);
  border-radius: 14px;
  background: var(--ps-panel);
  box-shadow: 0 16px 36px rgba(21, 42, 55, 0.2);
  color: var(--ps-ink);
}

.ask-foresight-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 13px 16px;
  background: var(--ps-teal);
  color: var(--ps-white);
}

.ask-foresight-chat-heading {
  min-width: 0;
}
.ask-foresight-chat-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 800;
}
.ask-foresight-chat-heading p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  line-height: 1.35;
}
.ask-foresight-chat-controls {
  display: flex;
  gap: 3px;
}

.ask-foresight-icon-button,
.ask-foresight-send {
  display: inline-grid;
  place-items: center;
  border: 0;
  cursor: pointer;
}

.ask-foresight-icon-button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  color: var(--ps-white);
}

.ask-foresight-icon-button:hover {
  background: rgba(255, 255, 255, 0.14);
}
.ask-foresight-icon-button:focus-visible,
.ask-foresight-send:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.ask-foresight-context {
  display: grid;
  gap: 3px;
  margin: 12px 14px 0;
  padding: 10px 12px;
  border: 1px solid #d2e6e5;
  border-radius: 9px;
  background: #f0f8f7;
}

.ask-foresight-context span {
  color: var(--ps-teal-dark);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ask-foresight-context strong {
  color: var(--ps-charcoal);
  font-size: 12px;
  line-height: 1.35;
}
.ask-foresight-context small {
  color: var(--ps-muted);
  font-size: 11px;
  line-height: 1.35;
}

.ask-foresight-chat-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 20px;
  background: var(--ps-raised);
}

.ask-foresight-welcome {
  max-width: 290px;
  margin: 20px auto 0;
  text-align: center;
}
.ask-foresight-welcome-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #e9f5f4;
  color: var(--ps-teal-dark);
}
.ask-foresight-welcome h2 {
  margin: 12px 0 6px;
  color: var(--ps-charcoal);
  font-size: 17px;
  line-height: 1.25;
}
.ask-foresight-welcome p {
  margin: 0;
  color: var(--ps-muted);
  font-size: 12px;
  line-height: 1.5;
}
.ask-foresight-suggestions {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  text-align: left;
}
.ask-foresight-suggestions button {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  background: var(--ps-white);
  color: var(--ps-charcoal);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.ask-foresight-suggestions button:hover {
  border-color: #9fc8ca;
  background: #f2f9f8;
}

.ask-foresight-messages {
  display: grid;
  gap: 12px;
}
.ask-foresight-message {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  max-width: 88%;
  color: var(--ps-charcoal);
  font-size: 12px;
  line-height: 1.5;
}
.ask-foresight-message > div {
  padding: 10px 11px;
  border: 1px solid var(--ps-line);
  border-radius: 10px;
  background: var(--ps-white);
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.04);
  white-space: pre-wrap;
}
.ask-foresight-message.is-user {
  justify-self: end;
  margin-left: auto;
}
.ask-foresight-message.is-user > div {
  border-color: #bfdddc;
  background: #e9f5f4;
}
.ask-foresight-message.is-assistant {
  justify-self: start;
}
.ask-foresight-message-mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: #e9f5f4;
  color: var(--ps-teal-dark);
}

.ask-foresight-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid var(--ps-line);
  background: var(--ps-white);
}

.ask-foresight-composer textarea {
  min-width: 0;
  flex: 1 1 auto;
  min-height: 36px;
  max-height: 90px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 8px;
  background: var(--ps-input);
  color: var(--ps-ink);
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
}

.ask-foresight-composer textarea:focus {
  border-color: var(--ps-teal);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(36, 124, 138, 0.12);
}
.ask-foresight-send {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--ps-teal);
  color: var(--ps-white);
}
.ask-foresight-send:hover {
  background: var(--ps-teal);
}

@media (max-width: 520px) {
  .ask-foresight-launcher {
    right: 16px;
    bottom: 16px;
  }
  .ask-foresight-chat {
    right: 16px;
    bottom: 64px;
    width: calc(100vw - 32px);
    height: min(520px, calc(100vh - 96px));
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--shell-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--ps-line);
  background: color-mix(in srgb, var(--ps-header) 96%, transparent);
  backdrop-filter: blur(10px);
}

.topbar-title-stack {
  min-width: 0;
  flex: 1 1 auto;
}

.foresight-page-topbar {
  min-height: 58px;
  padding: 12px 26px;
}

.foresight-page-brand {
  color: var(--ps-teal-text);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
}

.foresight-home-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ps-charcoal);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.foresight-home-wordmark > span:last-child {
  display: inline-flex;
}
.foresight-home-wordmark b {
  color: var(--ps-charcoal);
}
.foresight-home-wordmark em {
  color: var(--ps-teal-text);
  font-style: normal;
}
.foresight-wordmark-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  color: var(--ps-teal-dark);
  background: rgba(36, 124, 138, 0.11);
}

.epi-topbar {
  min-height: var(--shell-header-height);
  gap: 14px;
}

.epi-topbar .page-title {
  overflow: hidden;
  font-size: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-topbar {
  min-height: var(--shell-header-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 8px 22px;
}

.topbar-primary,
.topbar-secondary,
.topbar-epi-controls,
.topbar-save-load,
.topbar-user {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar-primary {
  gap: 16px;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
}

.topbar-brand img {
  height: 30px;
  width: auto;
  max-width: 178px;
  object-fit: contain;
}

.top-nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.top-nav-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ps-muted);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 850;
}

.top-nav-button svg {
  flex: 0 0 auto;
}

.top-nav-button:hover,
.top-nav-button.active {
  color: var(--ps-teal-dark);
  border-color: rgba(36, 124, 138, 0.2);
  background: var(--ps-teal-soft);
}

.top-nav-button.active {
  color: var(--ps-orange-dark);
  border-color: rgba(217, 101, 50, 0.32);
  background: var(--ps-accent-soft);
}

.topbar-secondary {
  gap: 12px;
  justify-content: space-between;
}

.page-crumbs {
  flex: 0 1 auto;
  min-width: 180px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 16px;
  color: #728095;
  font-size: 11px;
  font-weight: 800;
}

.breadcrumb button {
  padding: 0;
  border: 0;
  color: var(--ps-teal-dark);
  background: transparent;
  font: inherit;
}

.breadcrumb button:hover {
  color: var(--ps-orange-dark);
}

.topbar-epi-controls {
  flex: 1 1 auto;
  justify-content: space-between;
  gap: 14px;
}

.epi-topbar .topbar-title-stack {
  flex: 1 1 auto;
}

.topbar-save-load {
  justify-content: flex-end;
  gap: 8px;
}

.topbar-save-load .epi-template-action {
  flex-wrap: nowrap;
}

.topbar-save-load .epi-template-action .smart-select {
  min-width: 220px;
  max-width: 280px;
}

.topbar-user {
  flex: 0 0 auto;
  gap: 9px;
  padding-left: 12px;
  border-left: 1px solid var(--ps-line);
}

.page-kicker {
  color: var(--ps-teal-text);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.page-title {
  margin-top: 3px;
  color: var(--ps-charcoal);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.018em;
  line-height: 1.18;
}

.app-topbar .page-title {
  margin-top: 1px;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
