/* Final consistency layer for every authenticated legacy page. */
:root {
  --kl-page-gutter: 22px;
  --kl-section-gap: 18px;
  --kl-card-radius: 16px;
  --kl-border-soft: #e2e8f0;
  --kl-text-main: #1f2937;
  --kl-text-muted: #64748b;
  --kl-primary: #5d87ff;
}

html,
body,
.page-wrapper,
.body-wrapper,
.body-wrapper > .container,
.body-wrapper > .container-fluid,
.kanisa-legacy-shell,
.kanisa-legacy-shell .main-wrapper {
  background: #fff !important;
}

body,
button,
input,
select,
textarea,
.select2-container {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

body.kanisa-legacy-shell .body-wrapper > .container-fluid,
body.kanisa-legacy-shell .body-wrapper > .container {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 20px var(--kl-page-gutter) 40px !important;
  background: #fff !important;
}

body.kanisa-legacy-shell .body-wrapper > .container-fluid > :first-child,
body.kanisa-legacy-shell .body-wrapper > .container > :first-child {
  margin-top: 0 !important;
}

body.kanisa-legacy-shell .card,
body.kanisa-legacy-shell .panel,
body.kanisa-legacy-shell .workspace-card,
body.kanisa-legacy-shell .records-hero,
body.kanisa-legacy-shell .expense-hero,
body.kanisa-legacy-shell .structure-hero,
body.kanisa-legacy-shell .kl-auto-page-heading,
body.kanisa-legacy-shell .kl-related-navigation,
body.kanisa-legacy-shell .search-panel,
body.kanisa-legacy-shell .metric,
body.kanisa-legacy-shell .modal-content,
body.kanisa-legacy-shell .dropdown-menu {
  border: 1px solid var(--kl-border-soft) !important;
  border-radius: var(--kl-card-radius) !important;
  background-color: #fff !important;
  background-image: none !important;
  box-shadow: 0 10px 28px rgba(31, 41, 55, .055) !important;
}

body.kanisa-legacy-shell .card,
body.kanisa-legacy-shell .panel,
body.kanisa-legacy-shell .workspace-card,
body.kanisa-legacy-shell .kl-related-navigation {
  margin-bottom: var(--kl-section-gap) !important;
}

/* Layout wrappers arrange real cards. They must never become cards themselves. */
body.kanisa-legacy-shell .structure-workspace,
body.kanisa-legacy-shell .workflow-workspace,
body.kanisa-legacy-shell .records-shell,
body.kanisa-legacy-shell .expense-workspace,
body.kanisa-legacy-shell .entity-workspace,
body.kanisa-legacy-shell .dashboard-workspace,
body.kanisa-legacy-shell .core-overview-workspace,
body.kanisa-legacy-shell main[class$="-workspace"] {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body.kanisa-legacy-shell .card-body,
body.kanisa-legacy-shell .panel-body,
body.kanisa-legacy-shell .workspace-head,
body.kanisa-legacy-shell .modal-body {
  padding: 20px !important;
}

body.kanisa-legacy-shell .card-header,
body.kanisa-legacy-shell .card-footer,
body.kanisa-legacy-shell .modal-header,
body.kanisa-legacy-shell .modal-footer {
  border-color: var(--kl-border-soft) !important;
  background-color: #fff !important;
  background-image: none !important;
}

body.kanisa-legacy-shell .form-label,
body.kanisa-legacy-shell .field-label,
body.kanisa-legacy-shell label {
  color: #334155;
}

body.kanisa-legacy-shell .form-control,
body.kanisa-legacy-shell .form-select,
body.kanisa-legacy-shell .select2-container .select2-selection--single,
body.kanisa-legacy-shell .select2-container .select2-selection--multiple,
body.kanisa-legacy-shell .flatpickr-input {
  border-color: #d8e0ea !important;
  border-radius: 11px !important;
  background-color: #fff !important;
  color: var(--kl-text-main) !important;
  box-shadow: none !important;
}

body.kanisa-legacy-shell .form-control:focus,
body.kanisa-legacy-shell .form-select:focus,
body.kanisa-legacy-shell .select2-container--focus .select2-selection,
body.kanisa-legacy-shell .select2-container--open .select2-selection {
  border-color: var(--kl-primary) !important;
  box-shadow: 0 0 0 3px rgba(93, 135, 255, .12) !important;
}

body.kanisa-legacy-shell .table-responsive,
body.kanisa-legacy-shell .table-wrap {
  border: 1px solid var(--kl-border-soft);
  border-radius: 14px;
  background: #fff !important;
}

body.kanisa-legacy-shell .table {
  margin-bottom: 0;
  background: #fff !important;
}

body.kanisa-legacy-shell .table > :not(caption) > * > * {
  border-color: #edf1f5 !important;
  background: #fff !important;
  vertical-align: middle;
}

body.kanisa-legacy-shell .table thead th {
  color: #475569;
  font-weight: 700;
  background: #fff !important;
}

body.kanisa-legacy-shell .btn,
body.kanisa-legacy-shell button,
body.kanisa-legacy-shell a.btn {
  align-items: center;
  justify-content: center;
  gap: 7px;
}

body.kanisa-legacy-shell .btn i,
body.kanisa-legacy-shell button i,
body.kanisa-legacy-shell a i,
body.kanisa-legacy-shell .kl-inline-icon,
body.kanisa-legacy-shell [class$="-icon"],
body.kanisa-legacy-shell [class*="-icon "] {
  line-height: 1 !important;
}

body.kanisa-legacy-shell .btn > i,
body.kanisa-legacy-shell .btn > .kl-inline-icon,
body.kanisa-legacy-shell button > i,
body.kanisa-legacy-shell button > .kl-inline-icon {
  display: inline-grid !important;
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 1.1em;
  place-items: center;
  margin: 0 !important;
}

body.kanisa-legacy-shell .workflow-section-icon,
body.kanisa-legacy-shell .workflow-guide-icon,
body.kanisa-legacy-shell .structure-guidance-icon,
body.kanisa-legacy-shell .structure-quick-link-icon,
body.kanisa-legacy-shell .kl-related-action-icon,
body.kanisa-legacy-shell .kl-related-icon,
body.kanisa-legacy-shell .icon-box {
  display: grid !important;
  min-width: 44px;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center !important;
  padding: 0 !important;
  border-radius: 12px !important;
  background: #eef3ff !important;
  color: #4f76df !important;
}

body.kanisa-legacy-shell .workflow-section-icon > *,
body.kanisa-legacy-shell .workflow-guide-icon > *,
body.kanisa-legacy-shell .structure-guidance-icon > *,
body.kanisa-legacy-shell .structure-quick-link-icon > *,
body.kanisa-legacy-shell .kl-related-action-icon > *,
body.kanisa-legacy-shell .kl-related-icon > *,
body.kanisa-legacy-shell .icon-box > * {
  margin: 0 !important;
  align-self: center;
  justify-self: center;
}

body.kanisa-legacy-shell .alert,
body.kanisa-legacy-shell .response-message,
body.kanisa-legacy-shell [data-workflow-feedback] {
  border-radius: 12px !important;
}

body.kanisa-legacy-shell .security-note,
body.kanisa-legacy-shell [data-protected-deletion],
body.kanisa-legacy-shell .protected-deletion-note {
  display: none !important;
}

body.kanisa-legacy-shell .records-shell .metric-row .metric:last-child {
  display: none !important;
}

body.kanisa-legacy-shell .records-shell .metric-row {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* Bootstrap's default tab border sat directly against the tab labels. */
body.kanisa-legacy-shell .nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 12px !important;
  margin-bottom: 16px !important;
  border-bottom: 0 !important;
}

body.kanisa-legacy-shell .nav-tabs .nav-item {
  margin: 0 !important;
}

body.kanisa-legacy-shell .nav-tabs .nav-link {
  margin: 0 !important;
  border: 1px solid #dbe3ec !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #526174 !important;
  font-weight: 700;
}

body.kanisa-legacy-shell .nav-tabs .nav-link:hover {
  border-color: #afc3f5 !important;
  color: #315ec5 !important;
}

body.kanisa-legacy-shell .nav-tabs .nav-link.active {
  border-color: #5d87ff !important;
  background: #eef3ff !important;
  color: #315ec5 !important;
}

body.kanisa-legacy-shell .nav-tabs + .tab-content,
body.kanisa-legacy-shell .nav-tabs ~ .tab-content {
  margin-top: 0 !important;
}

.kanisa-recaptcha-gate {
  position: relative;
  margin-top: 4px;
}

.kanisa-recaptcha-gate .g-recaptcha {
  transition: opacity .18s ease, filter .18s ease;
}

.kanisa-recaptcha-gate.is-locked .g-recaptcha {
  pointer-events: none !important;
  opacity: .48;
  filter: grayscale(1);
}

.kanisa-recaptcha-helper {
  margin: 8px 0 0;
  color: #64748b;
  font-size: .78rem;
  line-height: 1.45;
}

.kanisa-boolean-badge {
  display: inline-flex;
  align-items: center;
  min-width: 48px;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 800;
}

.kanisa-boolean-badge.is-yes {
  border-color: #bde8d8;
  background: #eefbf6;
  color: #137255;
}

.kanisa-boolean-badge.is-no {
  border-color: #dce3eb;
  background: #f6f8fa;
  color: #64748b;
}

@media (max-width: 991.98px) {
  :root {
    --kl-page-gutter: 16px;
  }

  body.kanisa-legacy-shell .body-wrapper > .container-fluid,
  body.kanisa-legacy-shell .body-wrapper > .container {
    padding-top: 16px !important;
    padding-bottom: 30px !important;
  }

  body.kanisa-legacy-shell .card-body,
  body.kanisa-legacy-shell .panel-body,
  body.kanisa-legacy-shell .workspace-head,
  body.kanisa-legacy-shell .modal-body {
    padding: 16px !important;
  }

  body.kanisa-legacy-shell .records-shell .metric-row {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 420px) {
  :root {
    --kl-page-gutter: 12px;
  }

  body.kanisa-legacy-shell .card,
  body.kanisa-legacy-shell .panel,
  body.kanisa-legacy-shell .workspace-card,
  body.kanisa-legacy-shell .records-hero,
  body.kanisa-legacy-shell .expense-hero,
  body.kanisa-legacy-shell .structure-hero,
  body.kanisa-legacy-shell .kl-auto-page-heading,
  body.kanisa-legacy-shell .kl-related-navigation {
    border-radius: 13px !important;
  }
}
