.portal-module-body {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(1200px 460px at 8% -10%, rgba(39, 198, 96, 0.22), transparent 60%),
    radial-gradient(1000px 420px at 100% 0%, rgba(11, 18, 32, 0.12), transparent 60%),
    linear-gradient(180deg, #edf3f8 0%, #eef2f7 35%, #f7fafc 100%);
  color: var(--text);
}

/* Global portal white canvas (overrides older gradient background on short pages) */
body.portal-module-body {
  background: #ffffff !important;
}

body.portal-module-body .portal-wrap,
body.portal-module-body .portal-content {
  background: #ffffff !important;
}

.portal-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 14px 40px;
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.84);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 16px 46px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}
.portal-topbar.hidden {
  display: none;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(39, 198, 96, 0.2);
  padding: 5px;
}

.portal-brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.portal-brand-sub {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.portal-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-user-pill {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(39, 198, 96, 0.25);
  background: linear-gradient(180deg, #f7fff9 0%, #ecfdf3 100%);
  color: #0f5132;
  font-size: 12px;
  font-weight: 700;
}

.portal-outline-btn {
  border: 1px solid #d8e3ee;
  background: rgba(255,255,255,0.9);
  color: #0b1220;
  text-decoration: none;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.portal-nav {
  margin-top: 0;
  position: sticky;
  top: 0;
  z-index: 9;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  transform: translateZ(0);
}

.portal-nav-scroll {
  display: flex;
  gap: 6px;
  overflow-x: hidden;
  padding: 10px 14px;
  border-radius: 0;
  border: 0;
  background: #141921;
  backdrop-filter: none;
  flex-wrap: wrap;
}

.portal-nav-logo {
  display: inline-flex;
  align-items: center;
  padding-right: 8px;
  flex: 0 0 auto;
}

.portal-nav-logo-img {
  height: 28px;
  width: auto;
  display: block;
}

.portal-nav-link {
  color: #e2e8f0;
  border-color: rgba(255,255,255,0.08);
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
  font-weight: 600;
}

.portal-nav-link:hover {
  color: #ffffff;
  text-decoration: none;
}

.portal-nav-link.is-active {
  background: transparent;
  border: 0;
  color: #27c660;
  box-shadow: none;
}

@media (min-width: 1024px) {
  .portal-nav-logo {
    margin-left: 10px;
  }
}


.portal-flash {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d7e2ee;
  background: #fff;
  font-size: 13px;
}
.portal-flash.hidden { display: none; }
.portal-flash.success { background: #ecfdf3; border-color: #a7f3c0; color: #166534; }
.portal-flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.portal-flash.info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

.portal-content {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.portal-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #e3ebf3;
  background: rgba(255,255,255,0.95);
}

.portal-page-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.portal-page-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.portal-grid {
  display: grid;
  gap: 12px;
}
.portal-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.portal-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }

.portal-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.portal-list {
  display: grid;
  gap: 10px;
}

.portal-list-item {
  border: 1px solid #e4edf6;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
  padding: 12px;
}

.portal-list-item h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.portal-list-item p {
  margin: 4px 0;
  font-size: 13px;
  color: #334155;
}

.portal-form-grid {
  display: grid;
  gap: 10px;
}
.portal-form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }

.portal-empty {
  border: 1px dashed #d8e3ee;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  background: #fbfdff;
}

.portal-json {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin: 0;
  font-size: 12px;
  overflow: auto;
  max-height: 420px;
}

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

.portal-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #d8e2ec;
  background: #fff;
  color: #334155;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}
.portal-badge.green { background: #ecfdf3; border-color: #bbf7d0; color: #166534; }
.portal-badge.yellow { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.portal-badge.red { background: #fee2e2; border-color: #fecaca; color: #991b1b; }

.portal-toolbar-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.portal-select-inline {
  width: auto;
  min-width: 140px;
}

@media (max-width: 960px) {
  .portal-grid.two,
  .portal-grid.three,
  .portal-form-grid.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .portal-wrap {
    padding: 10px 8px 24px;
  }
  .portal-topbar {
    padding: 12px;
    border-radius: 16px;
  }
  .portal-page-header {
    padding: 12px;
  }
  .portal-page-header h1 {
    font-size: 18px;
  }
  .portal-brand-title {
    font-size: 16px;
  }
}

/* v9 module polish */
.portal-page-header {
  position: relative;
  overflow: hidden;
}

.portal-page-header::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -30px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(39,198,96,0.14) 0%, transparent 70%);
  pointer-events: none;
}

.portal-page-header > * {
  position: relative;
  z-index: 1;
}

.portal-card-head h2 {
  letter-spacing: -0.02em;
}

.portal-card-head .muted,
.portal-card-head p.muted {
  font-size: 12px;
  line-height: 1.4;
}

.portal-list-item {
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

.portal-list-item:hover {
  transform: translateY(-1px);
  border-color: rgba(39,198,96,0.20);
  box-shadow: 0 12px 24px rgba(15,23,42,0.05);
}

.portal-badge {
  letter-spacing: 0.01em;
}

.portal-empty {
  background:
    radial-gradient(circle at 0% 0%, rgba(39,198,96,0.05), transparent 55%),
    #fbfdff;
}

.portal-toolbar-inline .portal-select-inline {
  border-radius: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .portal-list-item {
    transition: none;
  }
}
