.kpip-portal{
  max-width: 980px;
  margin: 24px auto;
  padding: 0 16px;
}

.kpip-portal *{box-sizing:border-box;}

/* Wide tables: add a top horizontal scrollbar synced with the bottom one */
.kpip-hscroll-top{
  overflow-x:auto;
  overflow-y:hidden;
  height:16px;
  max-width:100%;
  -webkit-overflow-scrolling:touch;
  margin:6px 0;
}
.kpip-hscroll-top-inner{height:1px;}
.kpip-hscroll-bottom{
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

.kpip-portal__title{
  font-size: 24px;
  margin: 0 0 16px;
}

.kpip-portal__card{
  background: #ffffff;
  border: 1px solid #e2e4e7;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.kpip-portal__muted{
  color: #646970;
}

.kpip-portal__badge{
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 999px;
  background: #f0f0f1;
  color: #1d2327;
}

.kpip-portal__button{
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  background: #2271b1;
  color: #ffffff;
}

.kpip-portal__button:hover{
  background: #135e96;
  color: #ffffff;
}

.kpip-portal__list{
  margin: 12px 0 0;
  padding-left: 18px;
}


.kpip-portal__hr{
  margin: 16px 0;
  border: 0;
  border-top: 1px solid #e2e4e7;
}

.kpip-portal__h3{
  margin: 12px 0 10px;
}

.kpip-portal__dash-list{
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.kpip-portal__dash-item{
  margin: 0 0 8px;
}

.kpip-portal__dash-link{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e4e7;
  border-radius: 10px;
  background: #ffffff;
  text-decoration: none;
  color: inherit;
}

.kpip-portal__dash-link:hover{
  border-color: #c3c4c7;
}

.kpip-portal__dash-name{
  font-weight: 600;
}

.kpip-portal__dash-slug code{
  font-size: 12px;
  background: #f6f7f7;
  padding: 2px 6px;
  border-radius: 6px;
}

.kpip-dashboard{
  margin-top: 10px;
}

.kpip-dashboard__loading,
.kpip-dashboard__empty,
.kpip-dashboard__error{
  padding: 12px;
  border: 1px solid #e2e4e7;
  border-radius: 10px;
  background: #f6f7f7;
  color: #1d2327;
}

.kpip-dashboard__error{
  background: #fff2f2;
  border-color: #f1aeb5;
}

.kpip-dashboard__toolbar{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.kpip-dashboard__search{
  flex: 1 1 280px;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid #c3c4c7;
  border-radius: 10px;
}

.kpip-dashboard__btn{
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #c3c4c7;
  background: #ffffff;
  cursor: pointer;
}

.kpip-dashboard__btn:hover{
  border-color: #8c8f94;
}

.kpip-dashboard__btn--secondary{
  background: #f6f7f7;
}

.kpip-dashboard__period-filter{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kpip-dashboard__date{
  padding: 9px 10px;
  border: 1px solid #c3c4c7;
  border-radius: 10px;
  background: #ffffff;
}

.kpip-dashboard__period-sep{
  color: #646970;
  font-size: 12px;
}

/* Plan % highlighting (v1.7): <80% red, 80-99.99% yellow, >=100% green */
.kpip-pct-low{
  background: #fff2f2;
  color: #8a1f1f;
  font-weight: 600;
}

.kpip-pct-mid{
  background: #fff8e1;
  color: #665c00;
  font-weight: 600;
}

.kpip-pct-high{
  background: #eef8f1;
  color: #1d6f2a;
  font-weight: 600;
}

.kpip-dashboard__meta{
  flex: 0 0 auto;
  color: #646970;
  font-size: 12px;
}

.kpip-dashboard__table-wrap{
  border: 1px solid #e2e4e7;
  border-radius: 10px;
  overflow: auto;
  max-height: 70vh;
  background: #ffffff;
}

.kpip-dashboard__table{
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.kpip-dashboard__table thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f6f7f7;
  border-bottom: 1px solid #e2e4e7;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.kpip-dashboard__table tbody td{
  border-bottom: 1px solid #f0f0f1;
  padding: 9px 12px;
  vertical-align: top;
}

.kpip-dashboard__table tbody tr:hover td{
  background: #fbfbfc;
}

.kpip-sort-asc::after{
  content: " ▲";
  font-size: 11px;
  color: #646970;
}

.kpip-sort-desc::after{
  content: " ▼";
  font-size: 11px;
  color: #646970;
}

/* Copy row column */
.kpip-dashboard__table thead th.kpip-dashboard__th--copy{
  cursor: default;
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  text-align: center;
  padding: 10px 6px;
}
.kpip-dashboard__table tbody td.kpip-dashboard__td--copy{
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  text-align: center;
  padding: 6px;
  vertical-align: middle;
}
.kpip-copy-row-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dcdcde;
  background: #ffffff;
  color: #1d2327;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
}
.kpip-copy-row-btn:hover{
  background: #f6f7f7;
}
.kpip-copy-row-btn:active{
  transform: translateY(1px);
}
.kpip-copy-row-btn svg{
  display:block;
}


/* --- BI filters panel --- */
.kpip-filters{border:1px solid #e2e4e7;border-radius:10px;background:#fff;padding:12px;margin:0 0 12px 0;}
.kpip-filters__title{font-weight:700;margin:0 0 8px 0;}
.kpip-filters__row{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:8px 0;}
.kpip-filters__label{color:#646970;font-size:12px;}
.kpip-filters__input,.kpip-filters__select,.kpip-filters__search,.kpip-filters__multiselect{max-width:100%;box-sizing:border-box;border:1px solid #dcdcde;border-radius:8px;padding:6px 8px;}
.kpip-filters__multiselect{min-width:260px;height:92px;}
.kpip-filters__presets{display:flex;flex-wrap:wrap;gap:6px;}
.kpip-filters__preset{border:1px solid #dcdcde;background:#f6f7f7;border-radius:8px;padding:6px 8px;cursor:pointer;}
.kpip-filters__actions{display:flex;flex-wrap:wrap;gap:8px;}
.kpip-filters__btn{border:1px solid #dcdcde;background:#2271b1;color:#fff;border-radius:8px;padding:7px 10px;cursor:pointer;}
.kpip-filters__btn--secondary{background:#f6f7f7;color:#1d2327;}
.kpip-filters__note{margin-top:8px;color:#646970;font-size:12px;}
.kpip-filters__ignored{margin:6px 0 0 16px;padding:0;}

/* --- Refresh modal --- */
.kpip-modal__overlay{position:fixed;inset:0;background:rgba(0,0,0,0.35);z-index:9998;display:flex;align-items:center;justify-content:center;padding:20px;}
.kpip-modal{width:100%;max-width:520px;background:#fff;border-radius:12px;box-shadow:0 10px 40px rgba(0,0,0,0.25);overflow:hidden;z-index:9999;}
.kpip-modal__title{padding:14px 16px;font-weight:700;border-bottom:1px solid #e2e4e7;}
.kpip-modal__body{padding:14px 16px;}
.kpip-modal__footer{padding:12px 16px;border-top:1px solid #e2e4e7;display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap;}
.kpip-modal__input{width:100%;max-width:240px;}
.kpip-modal__presets{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0;}
.kpip-modal__note{color:#646970;font-size:12px;margin-top:10px;}
.kpip-modal__progress{margin-top:12px;font-size:12px;color:#646970;}
.kpip-modal__bar{height:10px;background:#f0f0f1;border-radius:999px;overflow:hidden;margin-top:6px;}
.kpip-modal__bar>div{height:10px;background:#2271b1;width:0%;}
.kpip-modal__btn{border:1px solid #dcdcde;background:#2271b1;color:#fff;border-radius:8px;padding:7px 10px;cursor:pointer;}
.kpip-modal__btn--secondary{background:#f6f7f7;color:#1d2327;}
.kpip-modal__error{color:#d63638;font-size:12px;margin-top:10px;}

/* ============================================================
   BI Filters (v1.8.4) — universal renderer by schema
   ============================================================ */

.kpip-filters--v184 {
  margin: 12px 0;
  padding: 12px;
  background: #fff;
  border: 1px solid #e2e4e7;
  border-radius: 10px;
}

.kpip-filters__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.kpip-filters__title {
  font-weight: 700;
}

.kpip-filters__active {
  font-size: 12px;
  color: #646970;
}

.kpip-filters__main-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.kpip-filter {
  min-width: 220px;
  max-width: 360px;
  flex: 1 1 220px;
}

.kpip-filter--full {
  flex: 1 1 100%;
  max-width: none;
}

.kpip-filter__label {
  font-size: 12px;
  color: #1d2327;
  margin-bottom: 4px;
  font-weight: 600;
}

.kpip-filter__help {
  font-size: 12px;
  color: #646970;
  margin-top: 4px;
}

.kpip-filter__status {
  font-size: 12px;
  color: #d63638;
  margin-top: 4px;
}

.kpip-filter__control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpip-filter__range {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.kpip-filter__range input {
  max-width: 170px;
}

.kpip-filter__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kpip-filters__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.kpip-filters__more {
  margin-top: 10px;
  border-top: 1px solid #f0f0f1;
  padding-top: 10px;
}

.kpip-filters__more > summary {
  cursor: pointer;
  font-weight: 600;
}

.kpip-filters__groups {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kpip-filters__group {
  border: 1px solid #e2e4e7;
  border-radius: 10px;
  background: #fafafa;
  padding: 8px;
}

.kpip-filters__group > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.kpip-filters__group-body {
  padding-top: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.kpip-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #f0f0f1;
  border-radius: 999px;
  font-size: 12px;
  color: #1d2327;
}

/* Unified multiselect */
.kpip-ms {
  border: 1px solid #dcdcde;
  border-radius: 8px;
  background: #fff;
}

.kpip-ms > summary {
  cursor: pointer;
  padding: 6px 8px;
  list-style: none;
}

.kpip-ms[open] > summary {
  border-bottom: 1px solid #f0f0f1;
}

.kpip-ms__body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpip-ms__search {
  width: 100%;
}

.kpip-ms__toggle {
  font-size: 12px;
  color: #646970;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpip-ms__status {
  font-size: 12px;
  color: #646970;
}

.kpip-ms__list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid #f0f0f1;
  border-radius: 8px;
  padding: 6px;
  background: #fcfcfc;
}

.kpip-ms__item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 2px;
}

.kpip-ms__item input {
  margin: 0;
}

.kpip-ms__item span {
  font-size: 13px;
  color: #1d2327;
}

/* ------------------------------------------------------------
   Frontend login (branded)
   ------------------------------------------------------------ */

.kpip-login {
  max-width: 520px;
  margin: 0 auto;
}

.kpip-login__card {
  padding: 22px;
}

.kpip-login__title {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 700;
  color: #1d2327;
}

.kpip-login__form {
  margin-top: 14px;
}

.kpip-login__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.kpip-login__label {
  font-size: 13px;
  color: #1d2327;
}

.kpip-login__input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #dcdcde;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  outline: none;
}

.kpip-login__input:focus {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px #2271b1;
}

.kpip-login__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 10px 0 14px;
  flex-wrap: wrap;
}

.kpip-login__remember {
  font-size: 13px;
  color: #1d2327;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpip-login__lost {
  font-size: 13px;
  color: #2271b1;
  text-decoration: none;
}

.kpip-login__lost:hover {
  text-decoration: underline;
}

.kpip-login__submit {
  width: 100%;
  justify-content: center;
}

.kpip-login__error {
  background: #fcf0f1;
  border: 1px solid #f2b1b6;
  color: #8a1f2b;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin: 10px 0 0;
}


/* v1.10.5: Refresh modal UX (progress + toast) */
.kpip-modal__status{margin-top:10px;font-size:13px;color:#1d2327;}
.kpip-modal__status--error{color:#d63638;}
.kpip-modal__progress{margin-top:12px;font-size:12px;color:#646970;}
.kpip-modal__progress-text{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;}
/* Backward compatibility: if some old markup used .kpip-modal__progress-bar */
.kpip-modal__progress-bar{height:10px;background:#2271b1;width:0%;border-radius:999px;}
/* Toast notifications */
.kpip-toast{position:fixed;right:20px;top:20px;z-index:10001;max-width:360px;padding:10px 12px;border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,0.20);background:#1d2327;color:#fff;opacity:0;transform:translateY(-10px);transition:opacity .2s ease, transform .2s ease;}
.kpip-toast--show{opacity:1;transform:translateY(0);}
.kpip-toast--success{background:#1f7a1f;}
.kpip-toast--error{background:#b32d2e;}
.kpip-toast--info{background:#1d2327;}

