/* Scoped portal styles: everything under .kbm-portal */
.kbm-portal{ direction:rtl; font-family: var(--kbm-font, inherit); }
.kbm-portal *{ box-sizing:border-box; }

.kbm-portal .kbm-shell{
  max-width: 1180px;
  margin: 24px auto;
  padding: 0 16px 60px;
}

.kbm-portal .kbm-header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  margin-bottom:14px;
}

.kbm-portal .kbm-title{ margin:0; font-size:22px; line-height:1.2; }
.kbm-portal .kbm-subtitle{ margin-top:6px; color:#6b7280; font-size:13px; }

.kbm-portal .kbm-tabs{
  display:flex;
  gap:10px;
  background:#fff;
  border:1px solid #eee;
  border-radius:16px;
  padding:8px;
  box-shadow: 0 10px 24px rgba(0,0,0,.04);
}

.kbm-portal .kbm-tab{
  flex:0 0 auto;
  border:0;
  background:transparent;
  padding:10px 14px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
  color:#374151;
}
.kbm-portal .kbm-tab.is-active{
  background:#111827;
  color:#fff;
}

.kbm-portal .kbm-content{ margin-top:14px; }

.kbm-portal .kbm-panel{
  background:#fff;
  border:1px solid #eee;
  border-radius:18px;
  padding:16px;
  box-shadow: 0 10px 24px rgba(0,0,0,.04);
}

.kbm-portal .kbm-panel-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  margin-bottom:12px;
}
.kbm-portal .kbm-panel-top h2{ margin:0; font-size:16px; }

.kbm-portal .kbm-btn{
  border:1px solid #e5e7eb;
  background:#fff;
  color:#111827;
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-weight:700;
  line-height:1;
}
.kbm-portal .kbm-btn:hover{ background:#f9fafb; }
.kbm-portal .kbm-btn-primary{
  background:#111827;
  color:#fff;
  border-color:#111827;
}
.kbm-portal .kbm-btn-primary:hover{ filter:brightness(.95); }
.kbm-portal .kbm-btn-sm{ padding:8px 10px; border-radius:10px; font-size:13px; }

.kbm-portal .kbm-table-wrap{ overflow:auto; border-radius:14px; border:1px solid #eee; }
.kbm-portal .kbm-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width: 820px;
}
.kbm-portal .kbm-table thead th{
  background:#f9fafb;
  text-align:right;
  font-size:13px;
  padding:12px;
  border-bottom:1px solid #eee;
  color:#374151;
}
.kbm-portal .kbm-table tbody td{
  padding:12px;
  border-bottom:1px solid #f1f5f9;
  vertical-align:middle;
}
.kbm-portal .kbm-table tbody tr:hover td{ background:#fcfcfd; }

.kbm-portal .kbm-thumb{
  width:54px; height:40px;
  border-radius:10px;
  background:#f3f4f6 center/cover no-repeat;
  border:1px solid #eee;
}

.kbm-portal .kbm-actions-cell{ display:flex; gap:8px; flex-wrap:wrap; }

.kbm-portal .kbm-badge{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  line-height:1;
}
.kbm-portal .kbm-badge-green{ background:#ecfdf5; color:#065f46; border:1px solid #a7f3d0; }
.kbm-portal .kbm-badge-amber{ background:#fffbeb; color:#92400e; border:1px solid #fde68a; }
.kbm-portal .kbm-badge-soft{ background:#f3f4f6; color:#374151; border:1px solid #e5e7eb; }

.kbm-portal .kbm-pill{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  background:#111827;
  color:#fff;
  font-weight:800;
  font-size:12px;
}
.kbm-portal .kbm-pill-soft{
  background:#f3f4f6; color:#111827; border:1px solid #e5e7eb;
}

.kbm-portal .kbm-empty{
  padding:18px;
  border:1px dashed #e5e7eb;
  border-radius:14px;
  color:#6b7280;
  background:#fafafa;
}

.kbm-portal .kbm-card{
  max-width:520px; margin:24px auto;
  background:#fff; border:1px solid #eee;
  border-radius:18px; padding:18px;
  box-shadow: 0 10px 24px rgba(0,0,0,.04);
}

.kbm-portal .kbm-actions{ display:flex; gap:10px; margin-top:14px; }

.kbm-portal .kbm-modal{ position:fixed; inset:0; display:none; z-index:9999; }
.kbm-portal .kbm-modal.is-open{ display:block; }
.kbm-portal .kbm-modal-backdrop{ position:absolute; inset:0; background:rgba(17,24,39,.55); }
.kbm-portal .kbm-modal-dialog{
  position:relative;
  width:min(760px, calc(100% - 24px));
  margin: 46px auto;
  background:#fff;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.2);
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  overflow:hidden;
}
.kbm-portal .kbm-modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 14px;
  border-bottom:1px solid #eee;
  background:#fff;
}
.kbm-portal .kbm-modal-title{ font-weight:900; }
.kbm-portal .kbm-icon-btn{
  border:1px solid #e5e7eb;
  width:36px; height:36px;
  border-radius:12px;
  background:#fff;
  cursor:pointer;
  font-size:18px;
  line-height:1;
}
.kbm-portal .kbm-modal-body{ padding:14px; max-height: calc(100vh - 180px); overflow:auto; }

.kbm-portal .kbm-form .kbm-grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:12px;
}
.kbm-portal .kbm-col-12{ grid-column: span 12; }
.kbm-portal .kbm-col-6{ grid-column: span 6; }

@media (max-width: 860px){
  .kbm-portal .kbm-col-6{ grid-column: span 12; }
  .kbm-portal .kbm-panel-top{ flex-direction:column; align-items:flex-start; }
}

.kbm-portal .kbm-field label{
  display:block;
  font-weight:800;
  margin-bottom:8px;
  color:#111827;
  font-size:13px;
}
.kbm-portal .kbm-req{ color:#ef4444; }
.kbm-portal input[type="text"],
.kbm-portal input[type="url"],
.kbm-portal input[type="date"],
.kbm-portal select,
.kbm-portal textarea{
  width:100%;
  padding:11px 12px;
  border:1px solid #e5e7eb;
  border-radius:12px;
  outline:none;
  background:#fff;
}
.kbm-portal textarea{ resize:vertical; }
.kbm-portal input:focus, .kbm-portal select:focus, .kbm-portal textarea:focus{
  border-color:#111827;
  box-shadow: 0 0 0 4px rgba(17,24,39,.08);
}
.kbm-portal .kbm-help{ margin-top:8px; font-size:12px; color:#6b7280; }

.kbm-portal .kbm-form-actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid #f1f5f9;
}

.kbm-portal .kbm-view-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.kbm-portal .kbm-badges{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.kbm-portal .kbm-h3{ margin:0; font-size:16px; }
.kbm-portal .kbm-kv{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:10px;
  padding:12px;
  border:1px solid #eee;
  border-radius:14px;
  background:#fafafa;
  margin-bottom:12px;
}
@media (max-width: 680px){ .kbm-portal .kbm-kv{ grid-template-columns: 1fr; } }

.kbm-portal .kbm-prose{
  color:#111827;
  line-height:1.9;
  margin-bottom:12px;
}

.kbm-portal .kbm-gallery-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:10px;
  margin-bottom:10px;
}
@media (max-width: 860px){ .kbm-portal .kbm-gallery-grid{ grid-template-columns: repeat(2, 1fr); } }
.kbm-portal .kbm-gimg{
  display:block;
  width:100%;
  padding-top:70%;
  border-radius:14px;
  border:1px solid #eee;
  background:#f3f4f6 center/cover no-repeat;
}

.kbm-portal .kbm-toast{
  position:fixed;
  left:16px;
  bottom:16px;
  z-index:10000;
  background:#111827;
  color:#fff;
  padding:10px 12px;
  border-radius:12px;
  opacity:0;
  transform: translateY(12px);
  transition: all .18s ease;
  max-width:min(420px, calc(100% - 32px));
}
.kbm-portal .kbm-toast.is-show{ opacity:1; transform: translateY(0); }
.kbm-portal .kbm-toast.is-error{ background:#991b1b; }


/* Advertising plans: portal */
.kbm-portal .kbm-panel-note{
  margin-top:6px;
  color:#6b7280;
  font-size:13px;
  line-height:1.8;
}

.kbm-portal .kbm-plan-select-block{
  margin:0 0 16px;
  padding:16px;
  border:1px solid #e5e7eb;
  border-radius:18px;
  background:linear-gradient(180deg,#fff,#f9fafb);
}

.kbm-portal .kbm-plan-select-head{
  margin-bottom:12px;
}

.kbm-portal .kbm-plan-select-head h3{
  margin:0 0 6px;
  font-size:16px;
  font-weight:900;
  color:#111827;
}

.kbm-portal .kbm-plan-select-head p{
  margin:0;
  color:#6b7280;
  font-size:13px;
  line-height:1.9;
}

.kbm-portal .kbm-plan-options{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}

.kbm-portal .kbm-plan-option{
  display:block;
  cursor:pointer;
}

.kbm-portal .kbm-plan-option input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.kbm-portal .kbm-plan-card-ui{
  display:flex;
  min-height:100%;
  flex-direction:column;
  gap:9px;
  padding:15px;
  border:1px solid #e5e7eb;
  border-radius:18px;
  background:#fff;
  box-shadow:0 10px 24px rgba(15,23,42,.04);
  transition:border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.kbm-portal .kbm-plan-option:hover .kbm-plan-card-ui,
.kbm-portal .kbm-plan-option input:checked + .kbm-plan-card-ui,
.kbm-portal .kbm-plan-option.is-selected .kbm-plan-card-ui{
  border-color:#111827;
  box-shadow:0 18px 38px rgba(15,23,42,.10);
  transform:translateY(-1px);
}

.kbm-portal .kbm-plan-option.is-premium .kbm-plan-card-ui{
  background:linear-gradient(135deg,#fff 0%,#fffbeb 100%);
}

.kbm-portal .kbm-plan-card-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.kbm-portal .kbm-plan-card-top strong{
  color:#111827;
  font-size:16px;
  font-weight:950;
}

.kbm-portal .kbm-plan-card-top em{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:5px 10px;
  border-radius:999px;
  background:#111827;
  color:#fbbf24;
  font-style:normal;
  font-size:12px;
  font-weight:950;
}

.kbm-portal .kbm-plan-card-sub{
  color:#374151;
  font-size:13px;
  font-weight:800;
}

.kbm-portal .kbm-plan-card-duration{
  display:inline-flex;
  width:max-content;
  max-width:100%;
  padding:7px 10px;
  border-radius:999px;
  background:#f3f4f6;
  color:#111827;
  font-size:12px;
  font-weight:900;
}

.kbm-portal .kbm-plan-card-features{
  display:grid;
  gap:6px;
  margin-top:2px;
}

.kbm-portal .kbm-plan-card-features small{
  position:relative;
  padding-right:18px;
  color:#4b5563;
  font-size:12px;
  line-height:1.8;
}

.kbm-portal .kbm-plan-card-features small:before{
  content:"✓";
  position:absolute;
  right:0;
  top:0;
  color:#047857;
  font-weight:950;
}

.kbm-portal .kbm-plan-owner-grid{
  margin-bottom:14px;
}

.kbm-portal .kbm-plan-current-box{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0 0 14px;
  padding:14px;
  border:1px solid #e5e7eb;
  border-radius:16px;
  background:#f9fafb;
}

.kbm-portal .kbm-plan-current-box strong,
.kbm-portal .kbm-plan-cell strong{
  display:block;
  color:#111827;
  font-size:13px;
  margin-bottom:6px;
}

.kbm-portal .kbm-plan-current-box span{
  color:#4b5563;
  font-size:13px;
}

.kbm-portal .kbm-plan-cell{
  display:flex;
  align-items:flex-start;
  gap:6px;
  flex-wrap:wrap;
}

.kbm-portal .kbm-badge-red{
  background:#fef2f2;
  color:#991b1b;
  border:1px solid #fecaca;
}

.kbm-portal .kbm-badge-premium{
  background:#111827;
  color:#fbbf24;
  border:1px solid #111827;
}

.kbm-portal .kbm-plan-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.kbm-portal .kbm-user-plan-card{
  padding:15px;
  border:1px solid #e5e7eb;
  border-radius:18px;
  background:#fff;
  box-shadow:0 10px 24px rgba(15,23,42,.04);
}

.kbm-portal .kbm-user-plan-main{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.kbm-portal .kbm-user-plan-kicker{
  display:block;
  color:#9ca3af;
  font-size:12px;
  font-weight:900;
  margin-bottom:4px;
}

.kbm-portal .kbm-user-plan-card h3{
  margin:0;
  color:#111827;
  font-size:16px;
  line-height:1.7;
}

.kbm-portal .kbm-user-plan-meta{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  margin-bottom:12px;
}

.kbm-portal .kbm-user-plan-meta div{
  padding:10px;
  border:1px solid #f1f5f9;
  border-radius:14px;
  background:#fafafa;
}

.kbm-portal .kbm-user-plan-meta span{
  display:block;
  color:#9ca3af;
  font-size:11px;
  font-weight:900;
  margin-bottom:5px;
}

.kbm-portal .kbm-user-plan-meta strong{
  color:#374151;
  font-size:13px;
  font-weight:900;
}

@media (max-width:980px){
  .kbm-portal .kbm-plan-options{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width:720px){
  .kbm-portal .kbm-plan-options,
  .kbm-portal .kbm-plan-list{
    grid-template-columns:1fr;
  }

  .kbm-portal .kbm-plan-current-box,
  .kbm-portal .kbm-user-plan-main{
    align-items:stretch;
    flex-direction:column;
  }

  .kbm-portal .kbm-user-plan-meta{
    grid-template-columns:1fr;
  }
}

/* Payment upgrade */
.kbm-portal .kbm-badge-blue{
  background:#eff6ff;
  color:#1d4ed8;
  border:1px solid #bfdbfe;
}

.kbm-portal .kbm-plan-card-price{
  display:flex;
  align-items:flex-start;
  justify-content:center;
  flex-direction:column;
  gap:3px;
  width:max-content;
  max-width:100%;
  padding:8px 12px;
  border-radius:14px;
  background:#ecfdf5;
  color:#065f46;
  border:1px solid #a7f3d0;
  font-size:13px;
  font-weight:950;
}

.kbm-portal .kbm-plan-card-price del{
  color:#9ca3af;
  font-size:12px;
  font-weight:900;
  text-decoration-thickness:2px;
}

.kbm-portal .kbm-plan-card-price strong{
  color:#065f46;
  font-size:15px;
  font-weight:950;
}

.kbm-portal .kbm-plan-payment-line{
  display:block;
  margin-top:6px;
  color:#6b7280;
  font-size:12px;
  line-height:1.8;
}

.kbm-portal .kbm-user-plan-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  margin-top:4px;
}

.kbm-portal .kbm-payment-notice{
  margin:0 0 14px;
  padding:12px 14px;
  border-radius:14px;
  font-weight:800;
  line-height:1.8;
}
.kbm-portal .kbm-payment-notice.is-success{
  background:#ecfdf5;
  color:#065f46;
  border:1px solid #a7f3d0;
}
.kbm-portal .kbm-payment-notice.is-error{
  background:#fef2f2;
  color:#991b1b;
  border:1px solid #fecaca;
}

/* Logged-out portal gate */
.kbm-portal .kbm-auth-screen{
  min-height:min(72vh, 720px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:48px 16px;
}

.kbm-portal .kbm-auth-card{
  position:relative;
  overflow:hidden;
  width:min(560px, 100%);
  margin:0 auto;
  padding:28px;
  border:1px solid #e5e7eb;
  border-radius:28px;
  background:
    radial-gradient(circle at top right, rgba(17,24,39,.09), transparent 34%),
    linear-gradient(180deg,#fff 0%,#f9fafb 100%);
  box-shadow:0 24px 70px rgba(15,23,42,.10);
  text-align:center;
}

.kbm-portal .kbm-auth-card:before{
  content:"";
  position:absolute;
  inset:auto -85px -105px auto;
  width:230px;
  height:230px;
  border-radius:999px;
  background:rgba(17,24,39,.055);
  pointer-events:none;
}

.kbm-portal .kbm-auth-icon{
  position:relative;
  z-index:1;
  width:64px;
  height:64px;
  margin:0 auto 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:22px;
  background:#111827;
  color:#fff;
  font-size:30px;
  font-weight:950;
  box-shadow:0 16px 32px rgba(17,24,39,.18);
}

.kbm-portal .kbm-auth-kicker{
  position:relative;
  z-index:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-bottom:10px;
  padding:6px 11px;
  border:1px solid #e5e7eb;
  border-radius:999px;
  background:#fff;
  color:#374151;
  font-size:12px;
  font-weight:900;
}

.kbm-portal .kbm-auth-card h2{
  position:relative;
  z-index:1;
  margin:0 0 10px;
  color:#111827;
  font-size:24px;
  line-height:1.5;
  font-weight:950;
}

.kbm-portal .kbm-auth-card p{
  position:relative;
  z-index:1;
  max-width:440px;
  margin:0 auto;
  color:#6b7280;
  font-size:14px;
  line-height:2;
}

.kbm-portal .kbm-auth-actions{
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:18px;
}

@media (max-width: 620px){
  .kbm-portal .kbm-auth-screen{
    min-height:60vh;
    padding:28px 12px;
  }

  .kbm-portal .kbm-auth-card{
    padding:22px 16px;
    border-radius:24px;
  }

  .kbm-portal .kbm-auth-icon{
    width:56px;
    height:56px;
    border-radius:20px;
    font-size:26px;
  }

  .kbm-portal .kbm-auth-card h2{
    font-size:20px;
  }

  .kbm-portal .kbm-auth-card p{
    font-size:13px;
  }

  .kbm-portal .kbm-auth-actions{
    align-items:stretch;
    flex-direction:column;
  }

  .kbm-portal .kbm-auth-actions .kbm-btn{
    width:100%;
    min-height:44px;
  }
}

